mirror of https://github.com/ledisdb/ledisdb.git
update
This commit is contained in:
parent
014954c3b9
commit
6005467554
|
@ -30,7 +30,15 @@ const (
|
||||||
data: log1 data | log2 data | magic data
|
data: log1 data | log2 data | magic data
|
||||||
meta: log1 pos in data | log2 pos in data
|
meta: log1 pos in data | log2 pos in data
|
||||||
|
|
||||||
|
log id can not be 0, we use here for magic log
|
||||||
|
if data has no magic data, it means that we don't close replication gracefully.
|
||||||
|
so we must repair the log data
|
||||||
|
magic data = log0 data
|
||||||
|
|
||||||
we use table to mangage data + meta pair
|
we use table to mangage data + meta pair
|
||||||
|
|
||||||
|
we must guarantee that the log id is monotonic increment strictly.
|
||||||
|
if log1's id is 1, log2 must be 2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type FileStore struct {
|
type FileStore struct {
|
||||||
|
|
|
@ -1 +1,29 @@
|
||||||
package rpl
|
package rpl
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
)
|
||||||
|
|
||||||
|
type table struct {
|
||||||
|
baseName string
|
||||||
|
|
||||||
|
index int64
|
||||||
|
|
||||||
|
readonly bool
|
||||||
|
df *os.File
|
||||||
|
mf *os.File
|
||||||
|
|
||||||
|
first 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