コード例 #1
0
        public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit, Action onStorageInaccessible, Action onNestedTransactionEnter, Action onNestedTransactionExit)
        {
            configuration.Container.SatisfyImportsOnce(this);

            if (configuration.CacheDocumentsInMemory == false)
            {
                documentCacher = new NullDocumentCacher();
            }
            else
            {
                documentCacher = new DocumentCacher(configuration);
            }

            database           = configuration.DataDirectory;
            this.configuration = configuration;
            this.onCommit      = onCommit;

            path = database;
            if (Path.IsPathRooted(database) == false)
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, database);
            }
            database = Path.Combine(path, "Data");

            RecoverFromFailedCompact(database);

            new TransactionalStorageConfigurator(configuration, this).LimitSystemCache();

            uniquePrefix = Interlocked.Increment(ref instanceCounter) + "-" + Base62Util.Base62Random();
            CreateInstance(out instance, uniquePrefix + "-" + database);
            this.onNestedTransactionEnter = onNestedTransactionEnter;
            this.onNestedTransactionExit  = onNestedTransactionExit;
        }
コード例 #2
0
 public ServerNotifications(string url, FileConvention convention)
 {
     id = Interlocked.Increment(ref connectionCounter) + "/" +
          Base62Util.Base62Random();
     this.url        = url;
     this.convention = convention;
 }
コード例 #3
0
 public SubscriptionConnectionOptions()
 {
     ConnectionId = Interlocked.Increment(ref connectionCounter) + "/" + Base62Util.Base62Random();
     BatchOptions = new SubscriptionBatchOptions();
     ClientAliveNotificationInterval = TimeSpan.FromMinutes(2);
     TimeToWaitBeforeConnectionRetry = TimeSpan.FromSeconds(15);
     Strategy = SubscriptionOpeningStrategy.OpenIfFree;
 }
コード例 #4
0
        private void GenerateSecret(object parameter)
        {
            var key = parameter as ApiKeyDefinition;

            if (key == null)
            {
                return;
            }
            key.Secret = Base62Util.ToBase62(Guid.NewGuid()).Replace("-", "");
        }
コード例 #5
0
        protected RemoteChangesClientBase(
            string url,
            string apiKey,
            ICredentials credentials,
            TConventions conventions,
            Action onDispose)
        {
            // Precondition
            var api = this as TChangesApi;

            if (api == null)
            {
                throw new InvalidCastException(string.Format("The derived class does not implements {0}. Make sure the {0} interface is implemented by this class.", typeof(TChangesApi).Name));
            }

            ConnectionStatusChanged = LogOnConnectionStatusChanged;

            id = Interlocked.Increment(ref connectionCounter) + "/" + Base62Util.Base62Random();

            this.url         = url;
            this.credentials = new OperationCredentials(apiKey, credentials);
            this.onDispose   = onDispose;
            Conventions      = conventions;
            webSocket        = new RavenClientWebSocket();

            ConnectionTask = EstablishConnection()
                             .ObserveException()
                             .ContinueWith(task =>
            {
                task.AssertNotFailed();

                Task.Run(Receive);

                return(this as TChangesApi);
            });
        }
コード例 #6
0
 public SubscriptionConnectionOptions()
 {
     ConnectionId = Interlocked.Increment(ref connectionCounter) + "/" + Base62Util.Base62Random();
     BatchOptions = new SubscriptionBatchOptions();
     ClientAliveNotificationInterval = TimeSpan.FromMinutes(2);
 }