From dfb9c904128862c56df7cc4863eba440a7b7a289 Mon Sep 17 00:00:00 2001 From: siddontang Date: Wed, 9 Jul 2014 09:33:44 +0800 Subject: [PATCH] update documents --- README.md | 1 + README_CN.md | 1 + ledis/dump.go | 1 + ledis/ledis.go | 2 +- leveldb/db.go | 2 +- leveldb/iterator.go | 34 +++++++++++++++++----------------- 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index cfb736a..9943c33 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ Some server commands explaintions are [here](https://github.com/siddontang/ledis ## Thanks Gmail: cenqichao@gmail.com + Gmail: chendahui007@gmail.com ## Feedback diff --git a/README_CN.md b/README_CN.md index e8e639d..8faade3 100644 --- a/README_CN.md +++ b/README_CN.md @@ -86,6 +86,7 @@ ledisdb是一个用go实现的类似redis的高性能nosql数据库,底层基 ## 感谢 Gmail: cenqichao@gmail.com + Gmail: chendahui007@gmail.com ## 联系我 diff --git a/ledis/dump.go b/ledis/dump.go index bc0427c..95232de 100644 --- a/ledis/dump.go +++ b/ledis/dump.go @@ -15,6 +15,7 @@ import ( // |keylen(bigendian int32)|key|valuelen(bigendian int32)|value...... // //key and value are both compressed for fast transfer dump on network using snappy + type MasterInfo struct { LogFileIndex int64 LogPos int64 diff --git a/ledis/ledis.go b/ledis/ledis.go index 98a38f1..cb83d01 100644 --- a/ledis/ledis.go +++ b/ledis/ledis.go @@ -150,7 +150,7 @@ func (l *Ledis) FlushAll() error { return nil } -//very dangerous to use +// very dangerous to use func (l *Ledis) DataDB() *leveldb.DB { return l.ldb } diff --git a/leveldb/db.go b/leveldb/db.go index d79ee65..0148b61 100644 --- a/leveldb/db.go +++ b/leveldb/db.go @@ -1,4 +1,4 @@ -//a wrapper for c++ leveldb +// Package leveldb is a wrapper for c++ leveldb package leveldb /* diff --git a/leveldb/iterator.go b/leveldb/iterator.go index a1e69bb..6092e9d 100644 --- a/leveldb/iterator.go +++ b/leveldb/iterator.go @@ -23,12 +23,12 @@ const ( RangeOpen uint8 = 0x11 ) -//min must less or equal than max -//range type: -//close: [min, max] -//open: (min, max) -//lopen: (min, max] -//ropen: [min, max) +// min must less or equal than max +// range type: +// close: [min, max] +// open: (min, max) +// lopen: (min, max] +// ropen: [min, max) type Range struct { Min []byte Max []byte @@ -46,7 +46,7 @@ type Iterator struct { isValid C.uchar } -//Returns a copy of key. +// Returns a copy of key. func (it *Iterator) Key() []byte { var klen C.size_t kdata := C.leveldb_iter_key(it.it, &klen) @@ -57,7 +57,7 @@ func (it *Iterator) Key() []byte { return C.GoBytes(unsafe.Pointer(kdata), C.int(klen)) } -//Returns a copy of value. +// Returns a copy of value. func (it *Iterator) Value() []byte { var vlen C.size_t vdata := C.leveldb_iter_value(it.it, &vlen) @@ -68,8 +68,8 @@ func (it *Iterator) Value() []byte { return C.GoBytes(unsafe.Pointer(vdata), C.int(vlen)) } -//Returns a reference of key. -//you must be careful that it will be changed after next iterate. +// Returns a reference of key. +// you must be careful that it will be changed after next iterate. func (it *Iterator) RawKey() []byte { var klen C.size_t kdata := C.leveldb_iter_key(it.it, &klen) @@ -80,8 +80,8 @@ func (it *Iterator) RawKey() []byte { return slice(unsafe.Pointer(kdata), int(C.int(klen))) } -//Returns a reference of value. -//you must be careful that it will be changed after next iterate. +// Returns a reference of value. +// you must be careful that it will be changed after next iterate. func (it *Iterator) RawValue() []byte { var vlen C.size_t vdata := C.leveldb_iter_value(it.it, &vlen) @@ -92,7 +92,7 @@ func (it *Iterator) RawValue() []byte { return slice(unsafe.Pointer(vdata), int(C.int(vlen))) } -//Copy key to b, if b len is small or nil, returns a new one +// Copy key to b, if b len is small or nil, returns a new one func (it *Iterator) BufKey(b []byte) []byte { k := it.RawKey() if k == nil { @@ -106,7 +106,7 @@ func (it *Iterator) BufKey(b []byte) []byte { return append(b, k...) } -//Copy value to b, if b len is small or nil, returns a new one +// Copy value to b, if b len is small or nil, returns a new one func (it *Iterator) BufValue(b []byte) []byte { v := it.RawValue() if v == nil { @@ -150,7 +150,7 @@ func (it *Iterator) Seek(key []byte) { it.isValid = C.leveldb_iter_seek_ext(it.it, (*C.char)(unsafe.Pointer(&key[0])), C.size_t(len(key))) } -//Finds by key, if not found, nil returns +// Finds by key, if not found, nil returns func (it *Iterator) Find(key []byte) []byte { it.Seek(key) if it.Valid() { @@ -165,8 +165,8 @@ func (it *Iterator) Find(key []byte) []byte { return nil } -//Finds by key, if not found, nil returns, else a reference of value returns -//you must be careful that it will be changed after next iterate. +// Finds by key, if not found, nil returns, else a reference of value returns +// you must be careful that it will be changed after next iterate. func (it *Iterator) RawFind(key []byte) []byte { it.Seek(key) if it.Valid() {