Пример #1
0
void TRI_AddMethodVocbase (v8::Handle<v8::ObjectTemplate> tpl,
                           const char* const name,
                           v8::Handle<v8::Value>(*func)(v8::Arguments const&),
                           const bool isHidden) {
  if (isHidden) {
    // hidden method
    tpl->Set(TRI_V8_SYMBOL(name), v8::FunctionTemplate::New(func), v8::DontEnum);
  }
  else {
    // normal method
    tpl->Set(TRI_V8_SYMBOL(name), v8::FunctionTemplate::New(func));
  }
}
Пример #2
0
void TRI_AddGlobalFunctionVocbase (v8::Handle<v8::Context> context,
                                   const char* const name,
                                   v8::Handle<v8::Function> func,
                                   const bool isHidden) {
  // all global functions are read-only
  if (isHidden) {
    context->Global()->Set(TRI_V8_SYMBOL(name),
                           func,
                           static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
  }
  else {
    context->Global()->Set(TRI_V8_SYMBOL(name),
                           func,
                           v8::ReadOnly);
  }
}
Пример #3
0
void TRI_AddGlobalFunctionVocbase (v8::Handle<v8::Context> context,
                                   const char* const name,
                                   v8::Handle<v8::Value>(*func)(v8::Arguments const&),
                                   const bool isHidden) {
  // all global functions are read-only
  if (isHidden) {
    context->Global()->Set(TRI_V8_SYMBOL(name),
                           v8::FunctionTemplate::New(func)->GetFunction(),
                           static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
  }
  else {
    context->Global()->Set(TRI_V8_SYMBOL(name),
                           v8::FunctionTemplate::New(func)->GetFunction(),
                           v8::ReadOnly);
  }
}
Пример #4
0
TRI_v8_global_s::TRI_v8_global_s (v8::Isolate* isolate)
  : JSBarriers(),

    ErrorTempl(),
    GeneralCursorTempl(),
    ShapedJsonTempl(),
    TransactionTempl(),
    VocbaseColTempl(),
    VocbaseTempl(),

    BufferTempl(),
    FastBufferConstructor(),

    BufferConstant(),
    DeleteConstant(),
    GetConstant(),
    HeadConstant(),
    OptionsConstant(),
    PatchConstant(),
    PostConstant(),
    PutConstant(),

    AddressKey(),
    BodyFromFileKey(),
    BodyKey(),
    ClientKey(),
    CodeKey(),
    ContentTypeKey(),
    DomainKey(),
    ErrorKey(),
    ErrorMessageKey(),
    ErrorNumKey(),
    HeadersKey(),
    HttpOnlyKey(),
    IdKey(),
    IsSystemKey(),
    IsVolatileKey(),
    JournalSizeKey(),
    KeyOptionsKey(),
    LengthKey(),
    LifeTimeKey(),
    NameKey(),
    ParametersKey(),
    PathKey(),
    PrefixKey(),
    PortKey(),
    ProtocolKey(),
    RequestBodyKey(),
    RequestTypeKey(),
    ResponseCodeKey(),
    SecureKey(),
    ServerKey(),
    SuffixKey(),
    TransformationsKey(),
    UrlKey(),
    UserKey(),
    ValueKey(),
    WaitForSyncKey(),

    _FromKey(),
    _IdKey(),
    _KeyKey(),
    _OldRevKey(),
    _RevKey(),
    _ToKey(),

    DocumentIdRegex(),
    DocumentKeyRegex(),
    IdRegex(),
    IndexIdRegex(),

    _currentTransaction(0),
    _vocbase(0) {
  v8::HandleScope scope;

  BufferConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("Buffer"));
  DeleteConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("DELETE"));
  GetConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("GET"));
  HeadConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("HEAD"));
  OptionsConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("OPTIONS"));
  PatchConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("PATCH"));
  PostConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("POST"));
  PutConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("PUT"));
  
  AddressKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("address"));
  BodyFromFileKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("bodyFromFile"));
  BodyKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("body"));
  ClientKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("client"));
  CodeKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("code"));
  ContentTypeKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("contentType"));
  CookiesKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("cookies"));
  DomainKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("domain"));
  ErrorKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("error"));
  ErrorMessageKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("errorMessage"));
  ErrorNumKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("errorNum"));
  HeadersKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("headers"));
  HttpOnlyKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("httpOnly"));
  IdKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("id"));
  IsSystemKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("isSystem"));
  IsVolatileKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("isVolatile"));
  JournalSizeKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("journalSize"));
  KeyOptionsKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("keyOptions"));
  LengthKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("length"));
  LifeTimeKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("lifeTime"));
  NameKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("name"));
  ParametersKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("parameters"));
  PathKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("path"));
  PrefixKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("prefix"));
  PortKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("port"));
  ProtocolKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("protocol"));
  RequestBodyKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("requestBody"));
  RequestTypeKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("requestType"));
  ResponseCodeKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("responseCode"));
  SecureKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("secure"));
  ServerKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("server"));
  SuffixKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("suffix"));
  TransformationsKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("transformations"));
  UrlKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("url"));
  UserKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("user"));
  ValueKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("value"));
  WaitForSyncKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("waitForSync"));
  
  _FromKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_from"));
  _IdKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_id"));
  _KeyKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_key"));
  _OldRevKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_oldRev"));
  _RevKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_rev"));
  _ToKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_to"));
}
Пример #5
0
void TRI_AddGlobalVariableVocbase (v8::Handle<v8::Context> context,
                                   const char* const name,
                                   v8::Handle<v8::Value> value) {
  // all global functions are read-only
  context->Global()->Set(TRI_V8_SYMBOL(name), value, v8::ReadOnly);
}
Пример #6
0
void TRI_AddGlobalFunctionVocbase (v8::Handle<v8::Context> context,
                                   const char* const name,
                                   v8::Handle<v8::Function> func) {
  // all global functions are read-only
  context->Global()->Set(TRI_V8_SYMBOL(name), func, v8::ReadOnly);
}
Пример #7
0
void TRI_AddGlobalFunctionVocbase (v8::Handle<v8::Context> context,
                                   const char* const name,
                                   v8::Handle<v8::Value>(*func)(v8::Arguments const&)) {
  // all global functions are read-only
  context->Global()->Set(TRI_V8_SYMBOL(name), v8::FunctionTemplate::New(func)->GetFunction(), v8::ReadOnly);
}
Пример #8
0
TRI_v8_global_s::TRI_v8_global_s (v8::Isolate* isolate)
  : JSBarriers(),
    JSCollections(),

#ifdef TRI_ENABLE_CLUSTER
    AgencyTempl(),
    ClusterInfoTempl(),
    ServerStateTempl(),
    ClusterCommTempl(),
#endif
    ArangoErrorTempl(),
    SleepAndRequeueTempl(),
    SleepAndRequeueFuncTempl(),
    GeneralCursorTempl(),
    ShapedJsonTempl(),
    VocbaseColTempl(),
    VocbaseTempl(),

    BufferTempl(),
    FastBufferConstructor(),

    BufferConstant(),
    DeleteConstant(),
    GetConstant(),
    HeadConstant(),
    OptionsConstant(),
    PatchConstant(),
    PostConstant(),
    PutConstant(),

    AddressKey(),
    BodyFromFileKey(),
    BodyKey(),
    ClientKey(),
#ifdef TRI_ENABLE_CLUSTER
    ClientTransactionIDKey(),
#endif
    CodeKey(),
    CompatibilityKey(),
    ContentTypeKey(),
#ifdef TRI_ENABLE_CLUSTER
    CoordTransactionIDKey(),
#endif
    DatabaseKey(),
    DoCompactKey(),
    DomainKey(),
    ErrorKey(),
    ErrorMessageKey(),
    ErrorNumKey(),
    HeadersKey(),
    HttpOnlyKey(),
    IdKey(),
    IsSystemKey(),
    IsVolatileKey(),
    JournalSizeKey(),
    KeyOptionsKey(),
    LengthKey(),
    LifeTimeKey(),
    NameKey(),
#ifdef TRI_ENABLE_CLUSTER
    OperationIDKey(),
#endif
    ParametersKey(),
    PathKey(),
    PrefixKey(),
    PortKey(),
    ProtocolKey(),
    RequestBodyKey(),
    RequestTypeKey(),
    ResponseCodeKey(),
    SecureKey(),
    ServerKey(),
#ifdef TRI_ENABLE_CLUSTER
    ShardIDKey(),
#endif
    SleepKey(),
#ifdef TRI_ENABLE_CLUSTER
    StatusKey(),
#endif
    SuffixKey(),
#ifdef TRI_ENABLE_CLUSTER
    TimeoutKey(),
#endif
    TransformationsKey(),
    UrlKey(),
    UserKey(),
    ValueKey(),
    WaitForSyncKey(),

    _FromKey(),
    _DbNameKey(),
    _IdKey(),
    _KeyKey(),
    _OldRevKey(),
    _RevKey(),
    _ToKey(),

    _currentTransaction(0),
    _server(0),
    _vocbase(0),
    _loader(0),
    _allowUseDatabase(true) {
  v8::HandleScope scope;

  BufferConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("Buffer"));
  DeleteConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("DELETE"));
  GetConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("GET"));
  HeadConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("HEAD"));
  OptionsConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("OPTIONS"));
  PatchConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("PATCH"));
  PostConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("POST"));
  PutConstant = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("PUT"));

  AddressKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("address"));
  BodyFromFileKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("bodyFromFile"));
  BodyKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("body"));
  ClientKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("client"));
#ifdef TRI_ENABLE_CLUSTER
  ClientTransactionIDKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("clientTransactionID"));
#endif
  CodeKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("code"));
  CompatibilityKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("compatibility"));
  ContentTypeKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("contentType"));
  CookiesKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("cookies"));
#ifdef TRI_ENABLE_CLUSTER
  CoordTransactionIDKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("coordTransactionID"));
#endif
  DatabaseKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("database"));
  DoCompactKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("doCompact"));
  DomainKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("domain"));
  ErrorKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("error"));
  ErrorMessageKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("errorMessage"));
  ErrorNumKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("errorNum"));
  HeadersKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("headers"));
  HttpOnlyKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("httpOnly"));
  IdKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("id"));
  IsSystemKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("isSystem"));
  IsVolatileKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("isVolatile"));
  JournalSizeKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("journalSize"));
  KeyOptionsKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("keyOptions"));
  LengthKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("length"));
  LifeTimeKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("lifeTime"));
  NameKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("name"));
#ifdef TRI_ENABLE_CLUSTER
  OperationIDKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("operationID"));
#endif
  ParametersKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("parameters"));
  PathKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("path"));
  PrefixKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("prefix"));
  PortKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("port"));
  ProtocolKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("protocol"));
  RequestBodyKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("requestBody"));
  RequestTypeKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("requestType"));
  ResponseCodeKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("responseCode"));
  SecureKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("secure"));
  ServerKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("server"));
#ifdef TRI_ENABLE_CLUSTER
  ShardIDKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("shardID"));
#endif
  SleepKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("sleep"));
#ifdef TRI_ENABLE_CLUSTER
  StatusKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("status"));
#endif
  SuffixKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("suffix"));
#ifdef TRI_ENABLE_CLUSTER
  TimeoutKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("timeout"));
#endif
  TransformationsKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("transformations"));
  UrlKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("url"));
  UserKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("user"));
  ValueKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("value"));
  WaitForSyncKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("waitForSync"));

  _FromKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_from"));
  _DbNameKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_dbName"));
  _IdKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_id"));
  _KeyKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_key"));
  _OldRevKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_oldRev"));
  _RevKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_rev"));
  _ToKey = v8::Persistent<v8::String>::New(isolate, TRI_V8_SYMBOL("_to"));
}