コード例 #1
0
 public GeneralStorageActions(TableStorage storage, Table generalTable, Reference<WriteBatch> writeBatch, Reference<SnapshotReader> snapshot, IBufferPool bufferPool)
     : base(snapshot, bufferPool)
 {
     this.storage = storage;
     this.generalTable = generalTable;
     this.writeBatch = writeBatch;
     this.snapshot = snapshot;
 }
コード例 #2
0
		protected RavenJObject LoadJson(Table table, Slice key, WriteBatch writeBatch, out ushort version)
		{
			var read = table.Read(Snapshot, key, writeBatch);
			if (read == null)
			{
				version = 0;
				return null;
			} 
			
			using (var stream = read.Reader.AsStream())
			{
				version = read.Version;
				return stream.ToJObject();
			}
		}
コード例 #3
0
        public AttachmentsStorageActions(Table attachmentsTable,
                                         Reference<WriteBatch> writeBatch, 
                                         Reference<SnapshotReader> snapshot, 
                                         IUuidGenerator uuidGenerator, 
                                         TableStorage tableStorage,
                                         Raven.Storage.Voron.TransactionalStorage transactionalStorage, 
                                         IBufferPool bufferPool)
            :base(snapshot, bufferPool)
        {
            this.attachmentsTable = attachmentsTable;
            this.writeBatch = writeBatch;
            this.uuidGenerator = uuidGenerator;
            this.tableStorage = tableStorage;
            this.transactionalStorage = transactionalStorage;

            metadataIndex = tableStorage.Attachments.GetIndex(Tables.Attachments.Indices.Metadata);
        }
コード例 #4
0
ファイル: TableStorage.cs プロジェクト: jrusbatch/ravendb
		private void Initialize()
		{
			Documents = new Table(Tables.Documents.TableName, bufferPool, Tables.Documents.Indices.KeyByEtag, Tables.Documents.Indices.Metadata);
			Details = new Table(Tables.Details.TableName, bufferPool);
			IndexingStats = new TableOfStructures<IndexingWorkStatsFields>(Tables.IndexingStats.TableName,
				new StructureSchema<IndexingWorkStatsFields>()
					.Add<int>(IndexingWorkStatsFields.IndexId)
					.Add<int>(IndexingWorkStatsFields.IndexingAttempts)
					.Add<int>(IndexingWorkStatsFields.IndexingSuccesses)
					.Add<int>(IndexingWorkStatsFields.IndexingErrors)
					.Add<long>(IndexingWorkStatsFields.LastIndexingTime)
					.Add<long>(IndexingWorkStatsFields.CreatedTimestamp),
				bufferPool);

			IndexingMetadata = new Table(Tables.IndexingMetadata.TableName, bufferPool);
			LastIndexedEtags = new TableOfStructures<LastIndexedStatsFields>(Tables.LastIndexedEtags.TableName,
				new StructureSchema<LastIndexedStatsFields>()
					.Add<int>(LastIndexedStatsFields.IndexId)
					.Add<long>(LastIndexedStatsFields.LastTimestamp)
					.Add<byte[]>(LastIndexedStatsFields.LastEtag),
				bufferPool);

			DocumentReferences = new TableOfStructures<DocumentReferencesFields>(Tables.DocumentReferences.TableName,
				new StructureSchema<DocumentReferencesFields>()
					.Add<int>(DocumentReferencesFields.IndexId)
					.Add<string>(DocumentReferencesFields.Key)
					.Add<string>(DocumentReferencesFields.Reference),
				bufferPool, Tables.DocumentReferences.Indices.ByRef, Tables.DocumentReferences.Indices.ByView, Tables.DocumentReferences.Indices.ByViewAndKey, Tables.DocumentReferences.Indices.ByKey);

			Queues = new Table(Tables.Queues.TableName, bufferPool, Tables.Queues.Indices.ByName, Tables.Queues.Indices.Data);
			Lists = new Table(Tables.Lists.TableName, bufferPool, Tables.Lists.Indices.ByName, Tables.Lists.Indices.ByNameAndKey);

			Tasks = new TableOfStructures<TaskFields>(Tables.Tasks.TableName,
				new StructureSchema<TaskFields>()
					.Add<int>(TaskFields.IndexId)
					.Add<long>(TaskFields.AddedAt)
					.Add<byte[]>(TaskFields.TaskId)
					.Add<string>(TaskFields.Type)
					.Add<byte[]>(TaskFields.SerializedTask),
				bufferPool, Tables.Tasks.Indices.ByIndexAndType, Tables.Tasks.Indices.ByType, Tables.Tasks.Indices.ByIndex);

			ScheduledReductions = new TableOfStructures<ScheduledReductionFields>(Tables.ScheduledReductions.TableName,
				new StructureSchema<ScheduledReductionFields>()
					.Add<int>(ScheduledReductionFields.IndexId)
					.Add<int>(ScheduledReductionFields.Bucket)
					.Add<int>(ScheduledReductionFields.Level)
					.Add<long>(ScheduledReductionFields.Timestamp)
					.Add<string>(ScheduledReductionFields.ReduceKey)
					.Add<byte[]>(ScheduledReductionFields.Etag),
				bufferPool, Tables.ScheduledReductions.Indices.ByView, Tables.ScheduledReductions.Indices.ByViewAndLevelAndReduceKey);
			
			MappedResults = new TableOfStructures<MappedResultFields>(Tables.MappedResults.TableName,
				new StructureSchema<MappedResultFields>()
					.Add<int>(MappedResultFields.IndexId)
					.Add<int>(MappedResultFields.Bucket)
					.Add<long>(MappedResultFields.Timestamp)
					.Add<string>(MappedResultFields.ReduceKey)
					.Add<string>(MappedResultFields.DocId)
					.Add<byte[]>(MappedResultFields.Etag),
				bufferPool, Tables.MappedResults.Indices.ByView, Tables.MappedResults.Indices.ByViewAndDocumentId, Tables.MappedResults.Indices.ByViewAndReduceKey, Tables.MappedResults.Indices.ByViewAndReduceKeyAndSourceBucket, Tables.MappedResults.Indices.Data);

			ReduceKeyCounts = new TableOfStructures<ReduceKeyCountFields>(Tables.ReduceKeyCounts.TableName,
				new StructureSchema<ReduceKeyCountFields>()
					.Add<int>(ReduceKeyCountFields.IndexId)
					.Add<int>(ReduceKeyCountFields.MappedItemsCount)
					.Add<string>(ReduceKeyCountFields.ReduceKey),
				bufferPool, Tables.ReduceKeyCounts.Indices.ByView);

			ReduceKeyTypes = new TableOfStructures<ReduceKeyTypeFields>(Tables.ReduceKeyTypes.TableName,
				new StructureSchema<ReduceKeyTypeFields>()
					.Add<int>(ReduceKeyTypeFields.IndexId)
					.Add<int>(ReduceKeyTypeFields.ReduceType)
					.Add<string>(ReduceKeyTypeFields.ReduceKey),
				bufferPool, Tables.ReduceKeyTypes.Indices.ByView);

			Attachments = new Table(Tables.Attachments.TableName, bufferPool, Tables.Attachments.Indices.ByEtag, Tables.Attachments.Indices.Metadata);

			ReduceResults = new TableOfStructures<ReduceResultFields>(Tables.ReduceResults.TableName,
				new StructureSchema<ReduceResultFields>()
					.Add<int>(ReduceResultFields.IndexId)
					.Add<int>(ReduceResultFields.Level)
					.Add<int>(ReduceResultFields.SourceBucket)
					.Add<int>(ReduceResultFields.Bucket)
					.Add<long>(ReduceResultFields.Timestamp)
					.Add<string>(ReduceResultFields.ReduceKey)
					.Add<byte[]>(ReduceResultFields.Etag),
				bufferPool, Tables.ReduceResults.Indices.ByView, Tables.ReduceResults.Indices.ByViewAndReduceKeyAndLevel, Tables.ReduceResults.Indices.ByViewAndReduceKeyAndLevelAndSourceBucket, Tables.ReduceResults.Indices.ByViewAndReduceKeyAndLevelAndBucket, Tables.ReduceResults.Indices.Data);

			General = new Table(Tables.General.TableName, bufferPool);
			ReduceStats = new TableOfStructures<ReducingWorkStatsFields>(Tables.ReduceStats.TableName,
				new StructureSchema<ReducingWorkStatsFields>()
					.Add<int>(ReducingWorkStatsFields.ReduceAttempts)
					.Add<int>(ReducingWorkStatsFields.ReduceSuccesses)
					.Add<int>(ReducingWorkStatsFields.ReduceErrors)
					.Add<long>(ReducingWorkStatsFields.LastReducedTimestamp)
					.Add<byte[]>(ReducingWorkStatsFields.LastReducedEtag),
				bufferPool);
		}
コード例 #5
0
		private RavenJObject Load(Table table, string name, out ushort version)
		{
			var value = LoadJson(table, CreateKey(name), writeBatch.Value, out version);
			if (value == null)
				throw new IndexDoesNotExistsException(string.Format("There is no index with the name: '{0}'", name));

			return value;
		}
コード例 #6
0
		private void Initialize()
		{
			Documents = new Table(Tables.Documents.TableName, bufferPool, Tables.Documents.Indices.KeyByEtag, Tables.Documents.Indices.Metadata);
			Details = new Table(Tables.Details.TableName, bufferPool);
			IndexingStats = new Table(Tables.IndexingStats.TableName, bufferPool);
			IndexingMetadata = new Table(Tables.IndexingMetadata.TableName, bufferPool);
			LastIndexedEtags = new Table(Tables.LastIndexedEtags.TableName, bufferPool);
			DocumentReferences = new Table(Tables.DocumentReferences.TableName, bufferPool, Tables.DocumentReferences.Indices.ByRef, Tables.DocumentReferences.Indices.ByView, Tables.DocumentReferences.Indices.ByViewAndKey, Tables.DocumentReferences.Indices.ByKey);
			Queues = new Table(Tables.Queues.TableName, bufferPool, Tables.Queues.Indices.ByName, Tables.Queues.Indices.Data);
			Lists = new Table(Tables.Lists.TableName, bufferPool, Tables.Lists.Indices.ByName, Tables.Lists.Indices.ByNameAndKey);
			Tasks = new Table(Tables.Tasks.TableName, bufferPool, Tables.Tasks.Indices.ByIndexAndType, Tables.Tasks.Indices.ByType, Tables.Tasks.Indices.ByIndex);
			ScheduledReductions = new Table(Tables.ScheduledReductions.TableName, bufferPool, Tables.ScheduledReductions.Indices.ByView, Tables.ScheduledReductions.Indices.ByViewAndLevelAndReduceKey);
			MappedResults = new Table(Tables.MappedResults.TableName, bufferPool, Tables.MappedResults.Indices.ByView, Tables.MappedResults.Indices.ByViewAndDocumentId, Tables.MappedResults.Indices.ByViewAndReduceKey, Tables.MappedResults.Indices.ByViewAndReduceKeyAndSourceBucket, Tables.MappedResults.Indices.Data);
			ReduceKeyCounts = new Table(Tables.ReduceKeyCounts.TableName, bufferPool, Tables.ReduceKeyCounts.Indices.ByView);
			ReduceKeyTypes = new Table(Tables.ReduceKeyTypes.TableName, bufferPool, Tables.ReduceKeyTypes.Indices.ByView);
			Attachments = new Table(Tables.Attachments.TableName, bufferPool, Tables.Attachments.Indices.ByEtag, Tables.Attachments.Indices.Metadata);
			ReduceResults = new Table(Tables.ReduceResults.TableName, bufferPool, Tables.ReduceResults.Indices.ByView, Tables.ReduceResults.Indices.ByViewAndReduceKeyAndLevel, Tables.ReduceResults.Indices.ByViewAndReduceKeyAndLevelAndSourceBucket, Tables.ReduceResults.Indices.ByViewAndReduceKeyAndLevelAndBucket, Tables.ReduceResults.Indices.Data);
			General = new Table(Tables.General.TableName, bufferPool);
			ReduceStats = new Table(Tables.ReduceStats.TableName, bufferPool);
		}