Documentation ¶
Overview ¶
Document collection data file.
Common data file features.
A hash table of uint64 key-value pairs.
Index ¶
Constants ¶
View Source
const ( COL_FILE_GROWTH = uint64(134217728) // Grows by 128MB DOC_MAX_ROOM = 33554432 // Maximum size of a single document (initial size is halved) DOC_HEADER = 1 + 10 // Document header: validity (byte), document room (uint64) DOC_VALID = byte(1) // Document valid flag DOC_INVALID = byte(0) // Document invalid flag COL_FILE_REGION_SIZE = 1024 * 64 // Granulairty of locks // Document padding made of spaces (pre-compiled, 2048 bytes) PADDING = " " + " " + " " + " " + " " + " " + " " + " " LEN_PADDING = uint64(len(PADDING)) )
View Source
const ( HASH_TABLE_GROWTH = uint64(134217728) // Grows every 128MB ENTRY_VALID = byte(1) // Entry valid flag ENTRY_INVALID = byte(0) // Entry invalid flag ENTRY_SIZE = uint64(1 + 10 + 10) // Entry header: validity (byte), hash key (uint64) and value (uint64) BUCKET_HEADER_SIZE = uint64(10) // Bucket header: next bucket in chain (uint64) HASH_TABLE_REGION_SIZE = 1024 * 16384 // Granularity of locks )
View Source
const FILE_GROWTH_INCREMENTAL = uint64(16777216)
Variables ¶
This section is empty.
Functions ¶
func ConsecutiveTwenty0s ¶
Return true if the buffer begins with ten consecutive 0s.
Types ¶
type ColFile ¶
type ColFile struct { File *File // contains filtered or unexported fields }
func (*ColFile) ForAll ¶
Scan the entire data file, look for documents and invoke the function on each.
type File ¶
type File struct { Name string // File path and name Fh *os.File // File handle (in operating system) UsedSize, Size, Growth uint64 Buf gommap.MMap // Mapped file buffer }
func (*File) CheckSizeAndEnsure ¶
Ensure that the file has enough room for more data. Grow the file if necessary.
type HashTable ¶
type HashTable struct { File *File BucketSize, HashBits, PerBucket uint64 // Hash table configuration - size of bucket, number of bits NumBuckets, InitialBuckets uint64 // Total number of buckets, and number of "head" buckets // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.