Documentation ¶
Overview ¶
Document collection file.
A static hash table made of uint64 key-value pairs.
Index ¶
- Constants
- type ColFile
- type HashTable
- func (ht *HashTable) Clear()
- func (ht *HashTable) Get(key, limit uint64) (keys, vals []uint64)
- func (ht *HashTable) GetAll(limit uint64) (keys, vals []uint64)
- func (ht *HashTable) HashKey(key uint64) uint64
- func (ht *HashTable) NextBucket(bucket uint64) uint64
- func (ht *HashTable) Put(key, val uint64)
- func (ht *HashTable) Remove(key, val uint64)
Constants ¶
View Source
const ( COL_FILE_SIZE = uint64(1024 * 1024 * 16) // Size of collection data file DOC_MAX_ROOM = uint64(1024 * 1024 * 16) // Max single document size DOC_HEADER_SIZE = 1 + 10 // Size of document header - validity (byte), document room (uint64) DOC_VALID = byte(1) // Document valid flag DOC_INVALID = byte(0) // Document invalid flag // Pre-compiled document padding (2048 spaces) PADDING = " " + " " + " " + " " + " " + " " + " " + " " LEN_PADDING = uint64(len(PADDING)) )
View Source
const ( HT_FILE_SIZE = uint64(1024 * 1024 * 8) // Size of a hash table, it may grow by this size ENTRY_VALID = byte(1) // Entry valid flag ENTRY_INVALID = byte(0) // Entry invalid flag ENTRY_SIZE = uint64(1 + 10 + 10) // Size of entry header - validity (byte), hash key (uint64) and value (uint64) BUCKET_HEADER_SIZE = uint64(10) // Size of bucket header - next bucket in chain (uint64) // Hash table configuration PER_BUCKET = uint64(15) BUCKET_SIZE = uint64(PER_BUCKET*ENTRY_SIZE + BUCKET_HEADER_SIZE) HASH_BITS = uint64(14) // INITIAL_BUCKETS = 2 to the power of HASH_BITS INITIAL_BUCKETS = uint64(16384) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColFile ¶
type ColFile struct {
File *commonfile.File
}
func (*ColFile) ForAll ¶
Scan the entire data file, look for documents and invoke the function on each.
type HashTable ¶
type HashTable struct { Path []string File *commonfile.File Mutex *sync.RWMutex NumBuckets uint64 // Total number of buckets }
func (*HashTable) Clear ¶
func (ht *HashTable) Clear()
Clear all index entries, return to the initial size as well.
func (*HashTable) NextBucket ¶
Return the number (not address) of next chained bucket, 0 if there is not any.
Click to show internal directories.
Click to hide internal directories.