ledisdb/rpl/store.go

37 lines
632 B
Go
Raw Normal View History

2014-09-22 13:50:51 +04:00
package rpl
2014-09-15 18:42:25 +04:00
import (
"errors"
)
const (
InvalidLogID uint64 = 0
)
var (
2014-11-18 12:50:22 +03:00
ErrLogNotFound = errors.New("log not found")
ErrStoreLogID = errors.New("log id is less")
ErrNoBehindLog = errors.New("no behind commit log")
ErrCommitIDBehind = errors.New("commit id is behind last log id")
2014-09-15 18:42:25 +04:00
)
2014-09-22 13:50:51 +04:00
type LogStore interface {
2014-09-15 18:42:25 +04:00
GetLog(id uint64, log *Log) error
FirstID() (uint64, error)
LastID() (uint64, error)
// if log id is less than current last id, return error
StoreLog(log *Log) error
2014-09-17 13:54:04 +04:00
// Delete logs before n seconds
2014-09-22 13:50:51 +04:00
PurgeExpired(n int64) error
2014-09-15 18:42:25 +04:00
2014-11-11 10:20:26 +03:00
Sync() error
2014-09-15 18:42:25 +04:00
// Clear all logs
Clear() error
Close() error
}