本文整理汇总了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);
}
示例2: Batch
public void Batch(Action<IStorageActionsAccessor> action)
{
var tableStorage = new TableStorage(persistentSource);
tableStorage.Initialze();
var accessor = new StorageActionsAccessor(tableStorage);
action(accessor);
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例10: DocumentsStorageActions
public DocumentsStorageActions(TableStorage storage, ITransactionStorageActions transactionStorageActions, IUuidGenerator generator)
{
this.storage = storage;
this.transactionStorageActions = transactionStorageActions;
this.generator = generator;
}
示例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();
}
}
示例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;
}
示例13: QueueStorageActions
public QueueStorageActions(TableStorage storage, IUuidGenerator generator)
{
this.storage = storage;
this.generator = generator;
}
示例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;
}
示例15: GeneralStorageActions
public GeneralStorageActions(TableStorage storage)
{
this.storage = storage;
}