mirror of
https://github.com/gogrlx/bitcask.git
synced 2026-04-07 13:32:46 -07:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47ad6601f3 | ||
|
|
057c147f89 | ||
|
|
9fafcad9a6 | ||
|
|
c4faac9f7c | ||
|
|
43334647a6 | ||
|
|
f26a1b1727 | ||
|
|
1fca55d268 | ||
|
|
c640f7f7e7 |
19
README.md
19
README.md
@@ -5,10 +5,13 @@
|
||||
[](https://goreportcard.com/report/prologic/bitcask)
|
||||
[](https://godoc.org/github.com/prologic/bitcask)
|
||||
[](https://sourcegraph.com/github.com/prologic/bitcask?badge)
|
||||
[](https://github.com/prologic/bitcask)
|
||||
[](https://github.com/prologic/bitcask/releases)
|
||||
[](https://github.com/prologic/bitcask)
|
||||
|
||||
A high performance Key/Value store written in [Go](https://golang.org) with a predictable read/write performance and high throughput. Uses a [Bitcask](https://en.wikipedia.org/wiki/Bitcask) on-disk layout (LSM+WAL) similar to [Riak](https://riak.com/).
|
||||
[](https://microbadger.com/images/prologic/bitcask)
|
||||
[](https://microbadger.com/images/prologic/bitcask)
|
||||
|
||||
A high performance Key/Value store written in [Go](https://golang.org) with a predictable read/write performance and high throughput. Uses a [Bitcask](https://en.wikipedia.org/wiki/Bitcask) on-disk layout (LSM+WAL) similar to [Riak](https://riak.com/). 🗃️
|
||||
|
||||
For a more feature-complete Redis-compatible server, distributed key/value store have a look at [Bitraft](https://github.com/prologic/bitraft) which uses this library as its backend. Use [Bitcask](https://github.com/prologic/bitcask) as a starting point or if you want to embed in your application, use [Bitraft](https://github.com/prologic/bitraft) if you need a complete server/client solution with high availability with a Redis-compatible API.
|
||||
|
||||
@@ -19,23 +22,23 @@ For a more feature-complete Redis-compatible server, distributed key/value store
|
||||
* Builtin Redis-compatible server (`bitcaskd`)
|
||||
* Predictable read/write performance
|
||||
* Low latecny
|
||||
* High throughput (See: [Performance](README.md#Performance)
|
||||
* High throughput (See: [Performance](README.md#Performance) )
|
||||
|
||||
## Development
|
||||
|
||||
1. Get the source:
|
||||
1. Get the source
|
||||
|
||||
```#!bash
|
||||
$ git clone https://github.com/prologic/bitcask.git
|
||||
```
|
||||
|
||||
2. Install required tools:
|
||||
2. Install required tools
|
||||
|
||||
This library uses [Protobuf](https://github.com/protocolbuffers/protobuf) to serialize data on disk. Please follow the
|
||||
instructions for installing `protobuf` on your system. You will also need the
|
||||
following Go libraries/tools to generate Go code from Protobuf defs:
|
||||
|
||||
3. Build the project:
|
||||
3. Build the project
|
||||
|
||||
```#!bash
|
||||
$ make
|
||||
@@ -67,8 +70,8 @@ import "github.com/prologic/bitcask"
|
||||
func main() {
|
||||
db, _ := bitcask.Open("/tmp/db")
|
||||
defer db.Close()
|
||||
db.Set("Hello", []byte("World"))
|
||||
val, _ := db.Get("hello")
|
||||
db.Put("Hello", []byte("World"))
|
||||
val, _ := db.Get("Hello")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ var (
|
||||
// maximum allowed value size (configured with WithMaxValueSize).
|
||||
ErrValueTooLarge = errors.New("error: value too large")
|
||||
|
||||
// ErrChecksumFailed is the error returned if a key/valie retrieved does
|
||||
// ErrChecksumFailed is the error returned if a key/value retrieved does
|
||||
// not match its CRC checksum
|
||||
ErrChecksumFailed = errors.New("error: checksum failed")
|
||||
|
||||
@@ -54,7 +54,7 @@ type Bitcask struct {
|
||||
}
|
||||
|
||||
// Close closes the database and removes the lock. It is important to call
|
||||
// Close() as this is the only wat to cleanup the lock held by the open
|
||||
// Close() as this is the only way to cleanup the lock held by the open
|
||||
// database.
|
||||
func (b *Bitcask) Close() error {
|
||||
defer func() {
|
||||
@@ -74,7 +74,7 @@ func (b *Bitcask) Sync() error {
|
||||
}
|
||||
|
||||
// Get retrieves the value of the given key. If the key is not found or an/I/O
|
||||
// error occurs a null byte slice is returend along with the error.
|
||||
// error occurs a null byte slice is returned along with the error.
|
||||
func (b *Bitcask) Get(key string) ([]byte, error) {
|
||||
var df *internal.Datafile
|
||||
|
||||
@@ -142,7 +142,7 @@ func (b *Bitcask) Delete(key string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Scan performa a prefix scan of keys matching the given prefix and calling
|
||||
// Scan performs a prefix scan of keys matching the given prefix and calling
|
||||
// the function `f` with the keys found. If the function returns an error
|
||||
// no further keys are processed and the first error returned.
|
||||
func (b *Bitcask) Scan(prefix string, f func(key string) error) error {
|
||||
|
||||
@@ -626,6 +626,9 @@ func BenchmarkScan(b *testing.B) {
|
||||
keys = append(keys, key)
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
if !reflect.DeepEqual(expected, keys) {
|
||||
b.Fatal(fmt.Errorf("expected keys=#%v got=%#v", expected, keys))
|
||||
|
||||
@@ -32,7 +32,7 @@ func (m *Entry) Reset() { *m = Entry{} }
|
||||
func (m *Entry) String() string { return proto.CompactTextString(m) }
|
||||
func (*Entry) ProtoMessage() {}
|
||||
func (*Entry) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_entry_3e91842c99935ae2, []int{0}
|
||||
return fileDescriptor_entry_db5b99f271e6b4b6, []int{0}
|
||||
}
|
||||
func (m *Entry) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Entry.Unmarshal(m, b)
|
||||
@@ -84,9 +84,9 @@ func init() {
|
||||
proto.RegisterType((*Entry)(nil), "proto.Entry")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("entry.proto", fileDescriptor_entry_3e91842c99935ae2) }
|
||||
func init() { proto.RegisterFile("entry.proto", fileDescriptor_entry_db5b99f271e6b4b6) }
|
||||
|
||||
var fileDescriptor_entry_3e91842c99935ae2 = []byte{
|
||||
var fileDescriptor_entry_db5b99f271e6b4b6 = []byte{
|
||||
// 126 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4e, 0xcd, 0x2b, 0x29,
|
||||
0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x53, 0x4a, 0xc9, 0x5c, 0xac, 0xae,
|
||||
|
||||
@@ -20,6 +20,6 @@ fi
|
||||
|
||||
echo "Releasing ${TAG} ..."
|
||||
|
||||
git tag -a -s -m "Relase ${TAG}" "${TAG}"
|
||||
git tag -a -s -m "Release ${TAG}" "${TAG}"
|
||||
git push --tags
|
||||
goreleaser release --rm-dist
|
||||
|
||||
Reference in New Issue
Block a user