Update Mroonga to the latest version on 2015-07-02T04:12:21+0900

This commit is contained in:
Kentoku SHIBA 2015-07-02 04:12:21 +09:00
commit 06913d0162
329 changed files with 11202 additions and 2138 deletions

View file

@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
/* Copyright(C) 2011 Brazil
/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -123,6 +123,15 @@ void FileImpl::swap(FileImpl *rhs) {
std::swap(addr_, rhs->addr_);
}
void FileImpl::flush() {
if (!addr_) {
return;
}
BOOL succeeded = ::FlushViewOfFile(addr_, size_);
GRN_DAT_THROW_IF(IO_ERROR, !succeeded);
}
void FileImpl::create_(const char *path, UInt64 size) {
if ((path != NULL) && (path[0] != '\0')) {
file_ = ::CreateFileA(path, GRN_IO_FILE_CREATE_MODE,
@ -193,6 +202,15 @@ void FileImpl::swap(FileImpl *rhs) {
std::swap(length_, rhs->length_);
}
void FileImpl::flush() {
if (!addr_) {
return;
}
int result = ::msync(addr_, length_, MS_SYNC);
GRN_DAT_THROW_IF(IO_ERROR, result != 0);
}
void FileImpl::create_(const char *path, UInt64 size) {
GRN_DAT_THROW_IF(PARAM_ERROR,
size > static_cast<UInt64>(std::numeric_limits< ::off_t>::max()));

View file

@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
/* Copyright(C) 2011-2012 Brazil
/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -45,6 +45,8 @@ class FileImpl {
void swap(FileImpl *rhs);
void flush();
private:
void *ptr_;
UInt64 size_;

View file

@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
/* Copyright(C) 2011 Brazil
/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -63,5 +63,11 @@ void File::swap(File *rhs) {
rhs->impl_ = temp;
}
void File::flush() {
if (impl_) {
impl_->flush();
}
}
} // namespace dat
} // namespace grn

View file

@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
/* Copyright(C) 2011 Brazil
/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -46,6 +46,8 @@ class GRN_DAT_API File {
void swap(File *rhs);
void flush();
private:
FileImpl *impl_;

View file

@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
/* Copyright(C) 2011 Brazil
/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -168,6 +168,10 @@ void Trie::swap(Trie *trie) {
key_buf_.swap(&trie->key_buf_);
}
void Trie::flush() {
file_.flush();
}
void Trie::create_file(const char *file_name,
UInt64 file_size,
UInt32 max_num_keys,

View file

@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
/* Copyright(C) 2011 Brazil
/* Copyright(C) 2011-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -189,6 +189,8 @@ class GRN_DAT_API Trie {
header_->set_status_flags(status_flags() & ~CHANGING_MASK);
}
void flush();
private:
File file_;
Header *header_;