internal DeserializationContext(GetKeyOfEntryFunc getKeyOfEntry, BTreeValue *pEntry, ushort keyType, byte *source, uint sourceLength) { GetKeyOfEntry = getKeyOfEntry; _Key = default(TangleKey); _KeyCached = false; KeyType = keyType; ValuePointer = pEntry; Source = source; SourceLength = sourceLength; _Stream = null; }
internal SerializationContext(GetKeyOfEntryFunc getKeyOfEntry, BTreeValue *pEntry, ushort keyType, MemoryStream stream) { GetKeyOfEntry = getKeyOfEntry; ValuePointer = pEntry; KeyType = keyType; _Key = default(TangleKey); _KeyCached = false; _Stream = stream; BytesProvided = false; StreamInUse = false; _Bytes = default(ArraySegment <byte>); }
public BTree(StreamSource storage, string prefix) { Storage = storage; Prefix = prefix; IndexStream = Storage.Open(prefix + "index"); KeyStream = Storage.Open(prefix + "keys"); DataStream = Storage.Open(prefix + "data"); VersionCheck(IndexStream); VersionCheck(KeyStream); VersionCheck(DataStream); bool needInit = IndexStream.Length < BTreeHeader.Size; IndexStream.LengthChanging += IndexStream_LengthChanging; IndexStream.LengthChanged += IndexStream_LengthChanged; DataStream.LengthChanging += DataStream_LengthChanging; DataStream.LengthChanged += DataStream_LengthChanged; _GetKeyOfEntry = ReadKey; _HeaderRange = IndexStream.AccessRangeUncached(0, BTreeHeader.Size); if (needInit) { InitializeBTree(); } _FreelistBucketLocks = new object[FreelistIndex.BucketCount]; for (int i = 0; i < _FreelistBucketLocks.Length; i++) { _FreelistBucketLocks[i] = new object(); } EnsureFreelistExists(); }