Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( KEY_LEN = 8 // float64 VALUE_LEN = 8 // uint64 RECORD_LEN = int64(16) // KEY_LEN + VALUE_LEN HEADER = 8 )
Variables ¶
This section is empty.
Functions ¶
func FromRecord ¶
Types ¶
type Store ¶
Store is a os.File where we store key value paires
Example ¶
tmpDir := os.TempDir() f, _ := ioutil.TempFile(tmpDir, "*") store := Store{f} store.Put(ToRecord(1.99, 0)) store.Put(ToRecord(2.08, 1)) store.Put(ToRecord(2.08, 2)) store.Put(ToRecord(2.33, 3)) fmt.Println("count:", store.RecordCount()) fmt.Println(FromRecord(store.Get(3))) fmt.Println(FromRecord(store.Get(2))) fmt.Println(FromRecord(store.Get(1))) fmt.Println(FromRecord(store.Get(0)))
Output: count: 4 2.33 3 2.08 2 2.08 1 1.99 0
Click to show internal directories.
Click to hide internal directories.