public static int GetInitialPhysicalSize(Key *key, Input *input) { return (RecordInfo.GetLength() + Key.GetLength(default(Key *)) + Functions.InitialValueLength(key, input)); }
private void RecoverFromPage(long startRecoveryAddress, long fromLogicalAddressInPage, long untilLogicalAddressInPage, long pageLogicalAddress, long pagePhysicalAddress, int version) { var hash = default(long); var tag = default(ushort); var pointer = default(long); var recordStart = default(long); var bucket = default(HashBucket *); var entry = default(HashBucketEntry); var slot = default(int); pointer = fromLogicalAddressInPage; while (pointer < untilLogicalAddressInPage) { recordStart = pagePhysicalAddress + pointer; ref RecordInfo info = ref hlog.GetInfo(recordStart); if (info.IsNull()) { pointer += RecordInfo.GetLength(); continue; } if (!info.Invalid) { hash = comparer.GetHashCode64(ref hlog.GetKey(recordStart)); tag = (ushort)((ulong)hash >> Constants.kHashTagShift); entry = default(HashBucketEntry); FindOrCreateTag(hash, tag, ref bucket, ref slot, ref entry, hlog.BeginAddress); if (info.Version <= version) { entry.Address = pageLogicalAddress + pointer; entry.Tag = tag; entry.Pending = false; entry.Tentative = false; bucket->bucket_entries[slot] = entry.word; } else { info.Invalid = true; if (info.PreviousAddress < startRecoveryAddress) { entry.Address = info.PreviousAddress; entry.Tag = tag; entry.Pending = false; entry.Tentative = false; bucket->bucket_entries[slot] = entry.word; } } } pointer += hlog.GetRecordSize(recordStart); }
public override int GetRequiredRecordSize(long physicalAddress, int availableBytes) { // We need at least [record size] + [average key size] + [average value size] var reqBytes = GetAverageRecordSize(); if (availableBytes < reqBytes) { return(reqBytes); } // We need at least [record size] + [actual key size] + [average value size] reqBytes = RecordInfo.GetLength() + KeySize(physicalAddress) + ValueLength.GetAverageLength(); if (availableBytes < reqBytes) { return(reqBytes); } // We need at least [record size] + [actual key size] + [actual value size] reqBytes = RecordInfo.GetLength() + KeySize(physicalAddress) + ValueSize(physicalAddress); return(reqBytes); }
private long ValueOffset(long physicalAddress) => physicalAddress + RecordInfo.GetLength() + AlignedKeySize(physicalAddress);
public override AddressInfo *GetValueAddressInfo(long physicalAddress) { return((AddressInfo *)((byte *)physicalAddress + RecordInfo.GetLength() + keySize)); }
public override AddressInfo *GetKeyAddressInfo(long physicalAddress) { return((AddressInfo *)((byte *)physicalAddress + RecordInfo.GetLength())); }
public override int GetRecordSize(long physicalAddress) { return(RecordInfo.GetLength() + KeySize(physicalAddress) + ValueSize(physicalAddress)); }
public static Value *GetValue(long physicalAddress) { return((Value *)((byte *)physicalAddress + RecordInfo.GetLength() + Key.GetLength(default(Key *)))); }
public override int GetInitialRecordSize <Input>(ref Key key, ref Input input) { return(RecordInfo.GetLength() + KeyLength.GetLength(ref key) + ValueLength.GetInitialLength(ref input)); }
public override int GetAverageRecordSize() { return(RecordInfo.GetLength() + KeyLength.GetAverageLength() + ValueLength.GetAverageLength()); }
public static int GetAveragePhysicalSize() { return(RecordInfo.GetLength() + Key.GetLength(default(Key *)) + Value.GetLength(default(Value *))); }
public static int EstimatePhysicalSize(Key *key, Value *value) { return(RecordInfo.GetLength() + Key.GetLength(key) + Value.GetLength(value)); }
public static int GetPhysicalSize(long physicalAddress) { return(RecordInfo.GetLength() + Key.GetLength(default(Key *)) + Value.GetLength(default(Value *))); }
public override ref Key GetKey(long physicalAddress) { return(ref Unsafe.AsRef <Key>((byte *)physicalAddress + RecordInfo.GetLength())); }
public override int GetRecordSize(ref Key key, ref Value value) { return(RecordInfo.GetLength() + KeyLength.GetLength(ref key) + ValueLength.GetLength(ref value)); }
public override ref Value GetValue(long physicalAddress) { return(ref Unsafe.AsRef <Value>((byte *)physicalAddress + RecordInfo.GetLength() + KeySize(physicalAddress))); }
public static Key *GetKey(long physicalAddress) { return((Key *)((byte *)physicalAddress + RecordInfo.GetLength())); }