Skip to content

chrislee87/kvstore

Repository files navigation

kvstore

Kvstore for time series data, with indexing and data compression.

Features

  • Store data with a uint64 key, for example use date(20160101) as key
  • Support Get and Append
  • Support data compression, both gzip and snappy

Architectures

CompressCodec FileCapacity FileDataNums
Index(Key, Offset, Size) Index ... ...
Data Block Data Block ... ...

Each datafile contains three parts:

  • File header
    • File header contains CompressCodec, FileCapacity and FileDataNums.
  • Indexes
    • Indexes are sorted by key. Each index contains Key, Offset and Size for the corresponding data block.
  • Data blocks
    • Data blocks can be compressed, support gzip and snappy.

Usages

var (
	key1 uint64 = 20150110
	key2 uint64 = 20150120
	key3 uint64 = 20150130

	buf1 []byte = []byte("hello world 1.")
	buf2 []byte = []byte("hello world 2.")
	buf3 []byte = []byte("hello world 3.")
)

func main() {
	c := &Config{
		FileName:      "./data/gzip.file",
		FileCapacity:  3,
		CompressCodec: 1}

	kv, _ := New(c)

	kv.Append(key1, buf1)
	kv.Append(key2, buf2)
	kv.Append(key3, buf3)

	buf, _ := kv.Get(key1)

	kv.Close()
}

Discussion

Discussion at Go Forum.

About

Key-value database for time series data, with indexing and data compression.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy