• Home
  • History
  • Annotate
  • only in this directory
Name Date Size

..19-Aug-20204 KiB

.travis.ymlH A D19-Aug-2020290

examples/H19-Aug-20204 KiB

file.goH A D19-Aug-20203 KiB

item.goH A D19-Aug-20204 KiB

iterator.goH A D19-Aug-20203 KiB

LICENSEH A D19-Aug-202011.1 KiB

mm/H19-Aug-20204 KiB

nitro.goH A D19-Aug-202029.5 KiB

nitro_test.goH A D19-Aug-202018 KiB

nodelist.goH A D19-Aug-20201.7 KiB

nodelist_test.goH A D19-Aug-20201.5 KiB

nodetable/H19-Aug-20204 KiB

README.mdH A D19-Aug-20202.3 KiB

skiplist/H19-Aug-20204 KiB

README.md

1# nitro
2
3A high performance in-memory key-value item storage engine written in golang.
4The storage engine is based lock-free data structures and scales well with
5multicore CPUs.
6
7[![Build Status](https://travis-ci.org/couchbase/nitro.svg?branch=master)](https://travis-ci.org/couchbase/nitro)
8[![Go Report Card](https://goreportcard.com/badge/github.com/couchbase/nitro)](https://goreportcard.com/report/github.com/couchbase/nitro)
9[![GoDoc](https://godoc.org/github.com/couchbase/nitro?status.svg)](https://godoc.org/github.com/couchbase/nitro)
10
11
12### Features
13
14- Operations: insert, delete, iterator (lookup, range queries)
15- Supports multiple concurrent readers and writers which scales almost linearly
16- Database snapshots which facilitates stable and repeatable scans
17- Lock-free data structures ensures that concurrent readers and writers doesn't
18  block each other
19- The memory overhead of metadata of an item is 64 bytes
20- Fast snapshotting: Minimal overhead snapshots and they can be created frequently (eg,. every 10ms)
21- Optional memory manager based on jemalloc to avoid golang garbage collector
22  for higher performance
23- Custom key comparator
24- Fast backup and restore on disk
25
26### Example usage
27
28    // Create a nitro instance with default config
29   	db := nitro.New()
30	defer db.Close()
31
32    // Create a writer
33    // A writer should be created for every concurrent thread
34	w := db.NewWriter()
35	for i := 0; i < 100; i++ {
36		itm := []byte(fmt.Sprintf("item-%02d", i))
37		w.Put(itm)
38	}
39
40    // Create an immutable snapshot
41	snap1, _ := db.NewSnapshot()
42
43	for i := 0; i < 100; i++ {
44		if i%2 == 0 {
45			itm := []byte(fmt.Sprintf("item-%02d", i))
46			w.Delete(itm)
47		}
48	}
49
50    // Create an immutable snapshot
51	snap2, _ := db.NewSnapshot()
52
53    // Create an iterator for a snapshot
54	it1 := snap1.NewIterator()
55	count1 := 0
56	for it1.SeekFirst(); it1.Valid(); it1.Next() {
57		fmt.Println("snap-1", string(it1.Get()))
58		count1++
59	}
60
61    // Close snapshot and iterator once you have finished using them
62	it1.Close()
63	snap1.Close()
64
65    // Create an iterator for a snapshot
66	it2 := snap2.NewIterator()
67	count2 := 0
68	for it2.SeekFirst(); it2.Valid(); it2.Next() {
69		fmt.Println("snap-2", string(it2.Get()))
70		count2++
71	}
72
73    // Close snapshot and iterator once you have finished using them
74	it2.Close()
75	snap2.Close()
76
77	fmt.Println(count2 == count1/2)
78    
79
80### License
81
82Apache 2.0
83