ledisdb: github.com/siddontang/ledisdb/rpl Index | Files

package rpl

import "github.com/siddontang/ledisdb/rpl"

Index

Package Files

file_io.go file_store.go file_table.go goleveldb_store.go log.go rpl.go store.go

Constants

const (
    InvalidLogID uint64 = 0
)
const LogHeadSize = 17

Variables

var (
    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")
)

type FileStore Uses

type FileStore struct {
    LogStore
    // contains filtered or unexported fields
}

func NewFileStore Uses

func NewFileStore(base string, cfg *config.Config) (*FileStore, error)

func (*FileStore) Clear Uses

func (s *FileStore) Clear() error

func (*FileStore) Close Uses

func (s *FileStore) Close() error

func (*FileStore) FirstID Uses

func (s *FileStore) FirstID() (uint64, error)

func (*FileStore) GetLog Uses

func (s *FileStore) GetLog(id uint64, l *Log) error

func (*FileStore) LastID Uses

func (s *FileStore) LastID() (uint64, error)

func (*FileStore) PurgeExpired Uses

func (s *FileStore) PurgeExpired(n int64) error

func (*FileStore) StoreLog Uses

func (s *FileStore) StoreLog(l *Log) error

func (*FileStore) Sync Uses

func (s *FileStore) Sync() error

type GoLevelDBStore Uses

type GoLevelDBStore struct {
    LogStore
    // contains filtered or unexported fields
}

func NewGoLevelDBStore Uses

func NewGoLevelDBStore(base string, syncLog int) (*GoLevelDBStore, error)

func (*GoLevelDBStore) Clear Uses

func (s *GoLevelDBStore) Clear() error

func (*GoLevelDBStore) Close Uses

func (s *GoLevelDBStore) Close() error

func (*GoLevelDBStore) FirstID Uses

func (s *GoLevelDBStore) FirstID() (uint64, error)

func (*GoLevelDBStore) GetLog Uses

func (s *GoLevelDBStore) GetLog(id uint64, log *Log) error

func (*GoLevelDBStore) LastID Uses

func (s *GoLevelDBStore) LastID() (uint64, error)

func (*GoLevelDBStore) PurgeExpired Uses

func (s *GoLevelDBStore) PurgeExpired(n int64) error

func (*GoLevelDBStore) StoreLog Uses

func (s *GoLevelDBStore) StoreLog(log *Log) error

func (*GoLevelDBStore) Sync Uses

func (s *GoLevelDBStore) Sync() error

type Log Uses

type Log struct {
    ID          uint64
    CreateTime  uint32
    Compression uint8

    Data []byte
}

func (*Log) Decode Uses

func (l *Log) Decode(r io.Reader) error

func (*Log) DecodeAt Uses

func (l *Log) DecodeAt(r io.ReaderAt, pos int64) error

func (*Log) DecodeHead Uses

func (l *Log) DecodeHead(r io.Reader) (uint32, error)

func (*Log) DecodeHeadAt Uses

func (l *Log) DecodeHeadAt(r io.ReaderAt, pos int64) (uint32, error)

func (*Log) Encode Uses

func (l *Log) Encode(w io.Writer) error

func (*Log) HeadSize Uses

func (l *Log) HeadSize() int

func (*Log) Marshal Uses

func (l *Log) Marshal() ([]byte, error)

func (*Log) Size Uses

func (l *Log) Size() int

func (*Log) Unmarshal Uses

func (l *Log) Unmarshal(b []byte) error

type LogStore Uses

type LogStore interface {
    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

    // Delete logs before n seconds
    PurgeExpired(n int64) error

    Sync() error

    // Clear all logs
    Clear() error

    Close() error
}

type Replication Uses

type Replication struct {
    // contains filtered or unexported fields
}

func NewReplication Uses

func NewReplication(cfg *config.Config) (*Replication, error)

func (*Replication) Clear Uses

func (r *Replication) Clear() error

func (*Replication) ClearWithCommitID Uses

func (r *Replication) ClearWithCommitID(id uint64) error

func (*Replication) Close Uses

func (r *Replication) Close() error

func (*Replication) CommitIDBehind Uses

func (r *Replication) CommitIDBehind() (bool, error)

func (*Replication) FirstLogID Uses

func (r *Replication) FirstLogID() (uint64, error)

func (*Replication) GetLog Uses

func (r *Replication) GetLog(id uint64, log *Log) error

func (*Replication) LastCommitID Uses

func (r *Replication) LastCommitID() (uint64, error)

func (*Replication) LastLogID Uses

func (r *Replication) LastLogID() (uint64, error)

func (*Replication) Log Uses

func (r *Replication) Log(data []byte) (*Log, error)

func (*Replication) NextNeedCommitLog Uses

func (r *Replication) NextNeedCommitLog(log *Log) error

func (*Replication) Stat Uses

func (r *Replication) Stat() (*Stat, error)

func (*Replication) StoreLog Uses

func (r *Replication) StoreLog(log *Log) error

func (*Replication) UpdateCommitID Uses

func (r *Replication) UpdateCommitID(id uint64) error

func (*Replication) WaitLog Uses

func (r *Replication) WaitLog() <-chan struct{}

type Stat Uses

type Stat struct {
    FirstID  uint64
    LastID   uint64
    CommitID uint64
}

Package rpl imports 18 packages (graph) and is imported by 12 packages. Updated 2017-03-21. Refresh now. Tools for package owners.