mirror of https://gitee.com/bigwinds/arangodb
in-memory collections, seem to work now
documentation and some helper functions are still missing
This commit is contained in:
parent
6dce10de80
commit
51305de692
|
@ -1312,10 +1312,10 @@ static v8::Handle<v8::Value> CreateVocBase (v8::Arguments const& argv, TRI_col_t
|
|||
}
|
||||
|
||||
v8::Handle<v8::Object> p = argv[1]->ToObject();
|
||||
v8::Handle<v8::String> waitForSyncKey = v8::String::New("waitForSync");
|
||||
v8::Handle<v8::String> journalSizeKey = v8::String::New("journalSize");
|
||||
v8::Handle<v8::String> isSystemKey = v8::String::New("isSystem");
|
||||
v8::Handle<v8::String> volatileKey = v8::String::New("isVolatile");
|
||||
v8::Handle<v8::String> isSystemKey = v8::String::New("isSystem");
|
||||
v8::Handle<v8::String> isVolatileKey = v8::String::New("isVolatile");
|
||||
v8::Handle<v8::String> journalSizeKey = v8::String::New("journalSize");
|
||||
v8::Handle<v8::String> waitForSyncKey = v8::String::New("waitForSync");
|
||||
v8::Handle<v8::String> createOptionsKey = v8::String::New("createOptions");
|
||||
|
||||
if (p->Has(journalSizeKey)) {
|
||||
|
@ -1347,14 +1347,21 @@ static v8::Handle<v8::Value> CreateVocBase (v8::Arguments const& argv, TRI_col_t
|
|||
parameter._isSystem = TRI_ObjectToBoolean(p->Get(isSystemKey));
|
||||
}
|
||||
|
||||
if (p->Has(volatileKey)) {
|
||||
parameter._isVolatile = TRI_ObjectToBoolean(p->Get(volatileKey));
|
||||
if (p->Has(isVolatileKey)) {
|
||||
#ifdef TRI_HAVE_ANONYMOUS_MMAP
|
||||
parameter._isVolatile = TRI_ObjectToBoolean(p->Get(isVolatileKey));
|
||||
#else
|
||||
TRI_FreeCollectionInfoOptions(¶meter);
|
||||
return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_ILLEGAL_OPTION, "volatile collections are not supported on this platform", true)));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (parameter._isVolatile && parameter._waitForSync) {
|
||||
// the combination of waitForSync and isVolatile makes no sense
|
||||
parameter._waitForSync = false;
|
||||
TRI_FreeCollectionInfoOptions(¶meter);
|
||||
return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_BAD_PARAMETER, "volatile collections do not support the waitForSync option", true)));
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
TRI_InitCollectionInfo(vocbase, ¶meter, name.c_str(), collectionType, effectiveSize, 0);
|
||||
|
|
|
@ -751,7 +751,12 @@ TRI_datafile_t* TRI_CreateDatafile (char const* filename,
|
|||
|
||||
// create either an anonymous or a physical datafile
|
||||
if (filename == NULL) {
|
||||
#ifdef TRI_HAVE_ANONYMOUS_MMAP
|
||||
datafile = TRI_CreateAnonymousDatafile(maximalSize);
|
||||
#else
|
||||
// system does not support anonymous mmap
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
datafile = TRI_CreatePhysicalDatafile(filename, maximalSize);
|
||||
|
@ -809,6 +814,8 @@ TRI_datafile_t* TRI_CreateDatafile (char const* filename,
|
|||
/// @brief creates a new anonymous datafile
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef TRI_HAVE_ANONYMOUS_MMAP
|
||||
|
||||
TRI_datafile_t* TRI_CreateAnonymousDatafile (const TRI_voc_size_t maximalSize) {
|
||||
TRI_datafile_t* datafile;
|
||||
ssize_t res;
|
||||
|
@ -818,6 +825,7 @@ TRI_datafile_t* TRI_CreateAnonymousDatafile (const TRI_voc_size_t maximalSize) {
|
|||
int fd;
|
||||
|
||||
// TODO: find a good workaround for Windows
|
||||
// TODO: make this more portable
|
||||
|
||||
#ifdef MAP_ANONYMOUS
|
||||
// this is required for "real" anonymous regions
|
||||
|
@ -872,6 +880,8 @@ TRI_datafile_t* TRI_CreateAnonymousDatafile (const TRI_voc_size_t maximalSize) {
|
|||
return datafile;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates a new physical datafile
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -434,7 +434,9 @@ TRI_datafile_t* TRI_CreateDatafile (char const*,
|
|||
/// automatically adds a @ref TRI_df_footer_marker_t to the file.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef TRI_HAVE_ANONYMOUS_MMAP
|
||||
TRI_datafile_t* TRI_CreateAnonymousDatafile (TRI_voc_size_t);
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates a new physical datafile
|
||||
|
|
|
@ -114,6 +114,9 @@
|
|||
#define TRI_HAVE_STRTOLL 1
|
||||
#define TRI_HAVE_STRTOULL 1
|
||||
|
||||
// TODO: add a feature check in configure
|
||||
#define TRI_HAVE_ANONYMOUS_MMAP 1
|
||||
|
||||
#define TRI_OVERLOAD_FUNCS_SIZE_T 1
|
||||
#define TRI_MISSING_MEMRCHR 1
|
||||
|
||||
|
@ -335,6 +338,9 @@ typedef int socket_t;
|
|||
#define TRI_HAVE_STRTOLL 1
|
||||
#define TRI_HAVE_STRTOULL 1
|
||||
|
||||
// TODO: add a feature check in configure
|
||||
#define TRI_HAVE_ANONYMOUS_MMAP 1
|
||||
|
||||
#if __WORDSIZE == 64
|
||||
#define TRI_SIZEOF_SIZE_T 8
|
||||
#define TRI_ALIGNOF_VOIDP 8
|
||||
|
|
Loading…
Reference in New Issue