forked from mirror/ledisdb
update, water many time......
This commit is contained in:
parent
6005467554
commit
912b799175
|
@ -10,20 +10,19 @@ if [ "$?" = 0 ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
go get github.com/siddontang/goleveldb/leveldb
|
|
||||||
|
|
||||||
go get github.com/szferi/gomdb
|
go get github.com/szferi/gomdb
|
||||||
|
|
||||||
go get github.com/boltdb/bolt
|
go get github.com/boltdb/bolt
|
||||||
|
|
||||||
go get github.com/ugorji/go/codec
|
go get github.com/ugorji/go/codec
|
||||||
go get github.com/BurntSushi/toml
|
go get github.com/BurntSushi/toml
|
||||||
|
go get github.com/edsrzf/mmap-go
|
||||||
|
|
||||||
|
go get github.com/siddontang/goleveldb/leveldb
|
||||||
go get github.com/siddontang/go/bson
|
go get github.com/siddontang/go/bson
|
||||||
go get github.com/siddontang/go/log
|
go get github.com/siddontang/go/log
|
||||||
go get github.com/siddontang/go/snappy
|
go get github.com/siddontang/go/snappy
|
||||||
go get github.com/siddontang/go/num
|
go get github.com/siddontang/go/num
|
||||||
go get github.com/siddontang/go/filelock
|
go get github.com/siddontang/go/filelock
|
||||||
go get github.com/siddontang/go/sync2
|
go get github.com/siddontang/go/sync2
|
||||||
go get github.com/siddontang/go/arena
|
go get github.com/siddontang/go/arena
|
||||||
|
|
|
@ -22,20 +22,18 @@ const (
|
||||||
|
|
||||||
/*
|
/*
|
||||||
File Store:
|
File Store:
|
||||||
0000001.data
|
00000001.log
|
||||||
0000001.meta
|
00000002.log
|
||||||
0000002.data
|
|
||||||
0000002.meta
|
|
||||||
|
|
||||||
data: log1 data | log2 data | magic data
|
log: log1 data | log2 data | split data | log1 offset | log 2 offset | offset start pos | offset length | magic data
|
||||||
meta: log1 pos in data | log2 pos in data
|
|
||||||
|
|
||||||
log id can not be 0, we use here for magic log
|
log id can not be 0, we use here for split data
|
||||||
if data has no magic data, it means that we don't close replication gracefully.
|
if data has no magic data, it means that we don't close replication gracefully.
|
||||||
so we must repair the log data
|
so we must repair the log data
|
||||||
magic data = log0 data
|
split data = log0 data
|
||||||
|
log0: id 0, create time 0, compression 0, data ""
|
||||||
we use table to mangage data + meta pair
|
//sha1 of github.com/siddontang/ledisdb 20 bytes
|
||||||
|
magic data = "\x1c\x1d\xb8\x88\xff\x9e\x45\x55\x40\xf0\x4c\xda\xe0\xce\x47\xde\x65\x48\x71\x17"
|
||||||
|
|
||||||
we must guarantee that the log id is monotonic increment strictly.
|
we must guarantee that the log id is monotonic increment strictly.
|
||||||
if log1's id is 1, log2 must be 2
|
if log1's id is 1, log2 must be 2
|
||||||
|
|
|
@ -1,29 +1,12 @@
|
||||||
package rpl
|
package rpl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type table struct {
|
type table struct {
|
||||||
baseName string
|
f *os.File
|
||||||
|
|
||||||
index int64
|
|
||||||
|
|
||||||
readonly bool
|
|
||||||
df *os.File
|
|
||||||
mf *os.File
|
|
||||||
|
|
||||||
first uint64
|
first uint64
|
||||||
last uint64
|
last uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func newReadTable(base string, index int64) (*table, error) {
|
|
||||||
t := new(table)
|
|
||||||
|
|
||||||
t.baseName = path.Join(base, fmt.Sprintf("%08d", index))
|
|
||||||
t.index = index
|
|
||||||
|
|
||||||
return t, nil
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue