当前位置: 首页>>代码示例>>C#>>正文


C# Impl.TableStorage类代码示例

本文整理汇总了C#中Raven.Storage.Managed.Impl.TableStorage的典型用法代码示例。如果您正苦于以下问题:C# TableStorage类的具体用法?C# TableStorage怎么用?C# TableStorage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TableStorage类属于Raven.Storage.Managed.Impl命名空间,在下文中一共展示了TableStorage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Batch

 public void Batch(Action<IStorageActionsAccessor> action)
 {
     var tableStorage = new TableStorage(persistentSource);
     tableStorage.Initialze();
     var accessor = new StorageActionsAccessor(tableStorage, new DummyUuidGenerator(), new AbstractDocumentCodec[0]);
     action(accessor);
 }
开发者ID:vinone,项目名称:ravendb,代码行数:7,代码来源:RemoteManagedStorage.cs

示例2: Batch

 public void Batch(Action<IStorageActionsAccessor> action)
 {
     var tableStorage = new TableStorage(persistentSource);
     tableStorage.Initialze();
     var accessor = new StorageActionsAccessor(tableStorage);
     action(accessor);
 }
开发者ID:Rationalle,项目名称:ravendb,代码行数:7,代码来源:RemoteManagedStorage.cs

示例3: DocumentsStorageActions

 public DocumentsStorageActions(TableStorage storage, ITransactionStorageActions transactionStorageActions, IUuidGenerator generator, IEnumerable<AbstractDocumentCodec> documentCodecs)
 {
     this.storage = storage;
     this.transactionStorageActions = transactionStorageActions;
     this.generator = generator;
     this.documentCodecs = documentCodecs;
 }
开发者ID:andrewdavey,项目名称:ravendb,代码行数:7,代码来源:DocumentsStorageActions.cs

示例4: CanOpenAfterCompaction

        public void CanOpenAfterCompaction()
        {
            var memoryPersistentSource = new MemoryPersistentSource();
            var tableStorage = new TableStorage(memoryPersistentSource);
            tableStorage.Initialze();
            tableStorage.BeginTransaction();
            tableStorage.Documents.Put(new JObject
            {
                {"key", "1"},
                {"etag", Guid.NewGuid().ToByteArray()},
                {"modified", DateTime.UtcNow},
                {"id", 1},
                {"entityName", "test"}
            }, new byte[512] );

            tableStorage.Documents.Put(new JObject
            {
                {"key", "2"},
                {"etag", Guid.NewGuid().ToByteArray()},
                {"modified", DateTime.UtcNow},
                {"id", 1},
                {"entityName", "test"}
            }, new byte[512] );
            tableStorage.Commit();

            tableStorage.BeginTransaction();
            tableStorage.Documents.Remove(new JObject { { "key", "1" } });
            tableStorage.Commit();

            tableStorage.Compact();


            var remoteManagedStorageState = memoryPersistentSource.CreateRemoteAppDomainState();
            new TableStorage(new MemoryPersistentSource(remoteManagedStorageState.Log)).Initialze();
        }
开发者ID:andrewdavey,项目名称:ravendb,代码行数:35,代码来源:OpenAfterCompaction.cs

示例5: AssertNotModifiedByAnotherTransaction

		public static void AssertNotModifiedByAnotherTransaction(TableStorage storage, ITransactionStorageActions transactionStorageActions, string key, Table.ReadResult readResult, TransactionInformation transactionInformation)
		{
			if (readResult == null)
				return;
			var txIdAsBytes = readResult.Key.Value<byte[]>("txId");
			if (txIdAsBytes == null)
				return;

			var txId = new Guid(txIdAsBytes);
			if (transactionInformation != null && transactionInformation.Id == txId)
			{
				return;
			}

			var existingTx = storage.Transactions.Read(new RavenJObject { { "txId", txId.ToByteArray() } });
			if (existingTx == null)//probably a bug, ignoring this as not a real tx
				return;

			var timeout = existingTx.Key.Value<DateTime>("timeout");
			if (SystemTime.UtcNow > timeout)
			{
				transactionStorageActions.RollbackTransaction(txId);
				return;
			}

			throw new ConcurrencyException("Document '" + key + "' is locked by transacton: " + txId);
		}
开发者ID:jtmueller,项目名称:ravendb,代码行数:27,代码来源:StorageHelper.cs

示例6: Batch

        public void Batch(Action<IStorageActionsAccessor> action)
        {
			using (var tableStorage = new TableStorage(persistentSource))
			{
				tableStorage.Initialze();
				var accessor = new StorageActionsAccessor(tableStorage, new DummyUuidGenerator(), new OrderedPartCollection<AbstractDocumentCodec>());
				action(accessor);
			}
        }
开发者ID:JPT123,项目名称:ravendb,代码行数:9,代码来源:RemoteManagedStorage.cs

示例7: StorageActionsAccessor

		public StorageActionsAccessor(TableStorage storage, IUuidGenerator generator, OrderedPartCollection<AbstractDocumentCodec> documentCodecs, IDocumentCacher documentCacher)
		{
			General = new GeneralStorageActions(storage);
			Attachments = new AttachmentsStorageActions(storage, generator);
			Transactions = new TransactionStorageActions(storage, generator, documentCodecs);
			Documents = new DocumentsStorageActions(storage, Transactions, generator, documentCodecs, documentCacher);
			Indexing = new IndexingStorageActions(storage);
			MappedResults = new MappedResultsStorageAction(storage, generator);
			Queue = new QueueStorageActions(storage, generator);
			Tasks = new TasksStorageActions(storage, generator);
			Staleness = new StalenessStorageActions(storage);
		}
开发者ID:JPT123,项目名称:ravendb,代码行数:12,代码来源:StorageActionsAccessor.cs

示例8: StorageActionsAccessor

 public StorageActionsAccessor(TableStorage storage, IUuidGenerator generator)
 {
     General = new GeneralStorageActions(storage);
     Attachments = new AttachmentsStorageActions(storage, generator);
     Transactions = new TransactionStorageActions(storage, generator);
     Documents = new DocumentsStorageActions(storage, Transactions, generator);
     Indexing = new IndexingStorageActions(storage);
     MappedResults = new MappedResultsStorageAction(storage, generator);
     Queue = new QueueStorageActions(storage, generator);
     Tasks = new TasksStorageActions(storage, generator);
     Staleness = new StalenessStorageActions(storage);
 }
开发者ID:VirtueMe,项目名称:ravendb,代码行数:12,代码来源:StorageActionsAccessor.cs

示例9: StorageActionsAccessor

 public StorageActionsAccessor(TableStorage storage, IUuidGenerator generator, IEnumerable<AbstractDocumentCodec> documentCodecs)
 {
     this.documentCodecs = documentCodecs;
     General = new GeneralStorageActions(storage);
     Attachments = new AttachmentsStorageActions(storage, generator);
     Transactions = new TransactionStorageActions(storage, generator, documentCodecs);
     Documents = new DocumentsStorageActions(storage, Transactions, generator, documentCodecs);
     Indexing = new IndexingStorageActions(storage);
     MappedResults = new MappedResultsStorageAction(storage, generator);
     Queue = new QueueStorageActions(storage, generator);
     Tasks = new TasksStorageActions(storage, generator);
     Staleness = new StalenessStorageActions(storage);
 }
开发者ID:vinone,项目名称:ravendb,代码行数:13,代码来源:StorageActionsAccessor.cs

示例10: DocumentsStorageActions

 public DocumentsStorageActions(TableStorage storage, ITransactionStorageActions transactionStorageActions, IUuidGenerator generator)
 {
     this.storage = storage;
     this.transactionStorageActions = transactionStorageActions;
     this.generator = generator;
 }
开发者ID:VirtueMe,项目名称:ravendb,代码行数:6,代码来源:DocumentsStorageActions.cs

示例11: Compact

		public void Compact(InMemoryRavenConfiguration compactConfiguration)
		{
			using (var ps = new FileBasedPersistentSource(compactConfiguration.DataDirectory, "Raven", configuration.TransactionMode == TransactionMode.Safe))
			using (var storage = new TableStorage(ps))
			{
				storage.Compact();
			}

		}
开发者ID:fschwiet,项目名称:ravendb,代码行数:9,代码来源:TransactionalStorage.cs

示例12: Initialize

		public bool Initialize(IUuidGenerator generator, OrderedPartCollection<AbstractDocumentCodec> documentCodecs)
		{
			DocumentCodecs = documentCodecs;
			uuidGenerator = generator;
			if (configuration.RunInMemory  == false && Directory.Exists(configuration.DataDirectory) == false)
				Directory.CreateDirectory(configuration.DataDirectory);

			persistenceSource = configuration.RunInMemory
						  ? (IPersistentSource)new MemoryPersistentSource()
						  : new FileBasedPersistentSource(configuration.DataDirectory, "Raven", configuration.TransactionMode == TransactionMode.Safe);

			tableStroage = new TableStorage(persistenceSource);

			idleTimer = new Timer(MaybeOnIdle, null, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30));

			tableStroage.Initialze();

			if (persistenceSource.CreatedNew)
			{
				Id = Guid.NewGuid();
				Batch(accessor => tableStroage.Details.Put("id", Id.ToByteArray()));
			}
			else
			{
				using(tableStroage.BeginTransaction())
				{
				var readResult = tableStroage.Details.Read("id");
				Id = new Guid(readResult.Data());
			}
			}

			return persistenceSource.CreatedNew;
		}
开发者ID:fschwiet,项目名称:ravendb,代码行数:33,代码来源:TransactionalStorage.cs

示例13: QueueStorageActions

		public QueueStorageActions(TableStorage storage, IUuidGenerator generator)
		{
			this.storage = storage;
			this.generator = generator;
		}
开发者ID:nberardi,项目名称:ravendb,代码行数:5,代码来源:QueueStorageActions.cs

示例14: Initialize

        public bool Initialize()
        {
            if (configuration.RunInMemory  == false && Directory.Exists(configuration.DataDirectory) == false)
                Directory.CreateDirectory(configuration.DataDirectory);

            persistenceSource = configuration.RunInMemory
                          ? (IPersistentSource)new MemoryPersistentSource()
                          : new FileBasedPersistentSource(configuration.DataDirectory, "Raven", configuration.TransactionMode);

            tableStroage = new TableStorage(persistenceSource);

            idleTimer = new Timer(MaybeOnIdle, null, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30));

            tableStroage.Initialze();

            if(persistenceSource.CreatedNew)
            {
                Id = Guid.NewGuid();
                Batch(accessor => tableStroage.Details.Put("id", Id.ToByteArray()));
            }
            else
            {
                var readResult = tableStroage.Details.Read("id");
                Id = new Guid(readResult.Data());
            }

            return persistenceSource.CreatedNew;
        }
开发者ID:Rationalle,项目名称:ravendb,代码行数:28,代码来源:TransactionalStorage.cs

示例15: GeneralStorageActions

		public GeneralStorageActions(TableStorage storage)
		{
			this.storage = storage;
		}
开发者ID:fschwiet,项目名称:ravendb,代码行数:4,代码来源:GeneralStorageActions.cs


注:本文中的Raven.Storage.Managed.Impl.TableStorage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。