storage

package
v0.0.0-...-feddf00 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MASTERVARIABLES_KEY = MINCHOSEN_KEY - 2
View Source
const MINCHOSEN_KEY = math.MaxUint64 - 1
View Source
const SYSTEMVARIABLES_KEY = MINCHOSEN_KEY - 1

Variables

This section is empty.

Functions

This section is empty.

Types

type LogStorage

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

func (*LogStorage) ClearAllLog

func (self *LogStorage) ClearAllLog() error

func (*LogStorage) Close

func (self *LogStorage) Close()

func (*LogStorage) Del

func (self *LogStorage) Del(options WriteOptions, instanceId uint64) error

func (*LogStorage) ForceDel

func (self *LogStorage) ForceDel(options WriteOptions, instanceId uint64) error

func (*LogStorage) Get

func (self *LogStorage) Get(instanceId uint64) ([]byte, error)

func (*LogStorage) GetDBPath

func (self *LogStorage) GetDBPath() string

func (*LogStorage) GetLogStorageDirPath

func (self *LogStorage) GetLogStorageDirPath() string

func (*LogStorage) GetMasterVariables

func (self *LogStorage) GetMasterVariables() ([]byte, error)

func (*LogStorage) GetMaxInstanceID

func (self *LogStorage) GetMaxInstanceID() (uint64, error)

func (*LogStorage) GetMaxInstanceIDFileID

func (self *LogStorage) GetMaxInstanceIDFileID() (string, uint64, error)

func (*LogStorage) GetMinChosenInstanceID

func (self *LogStorage) GetMinChosenInstanceID() (uint64, error)

func (*LogStorage) GetSystemVariables

func (self *LogStorage) GetSystemVariables() ([]byte, error)

func (*LogStorage) Init

func (self *LogStorage) Init(dbPath string) error

func (*LogStorage) Put

func (self *LogStorage) Put(options WriteOptions, instanceId uint64, value []byte) error

func (*LogStorage) SetMasterVariables

func (self *LogStorage) SetMasterVariables(options WriteOptions, buffer []byte) error

func (*LogStorage) SetMinChosenInstanceID

func (self *LogStorage) SetMinChosenInstanceID(minInstanceId uint64) error

func (*LogStorage) SetSystemVariables

func (self *LogStorage) SetSystemVariables(options WriteOptions, buffer []byte) error

type PaxosComparator

type PaxosComparator struct {
}

func (*PaxosComparator) Compare

func (self *PaxosComparator) Compare(a, b []byte) int

func (*PaxosComparator) Name

func (self *PaxosComparator) Name() string

func (*PaxosComparator) Separator

func (self *PaxosComparator) Separator(dst, a, b []byte) []byte

func (*PaxosComparator) Successor

func (self *PaxosComparator) Successor(dst, b []byte) []byte

type PaxosLog

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

func NewPaxosLog

func NewPaxosLog(logStorage *LogStorage) *PaxosLog

func (*PaxosLog) GetMaxInstanceIdFromLog

func (self *PaxosLog) GetMaxInstanceIdFromLog() (uint64, error)

common.ErrKeyNotFound or nil

func (*PaxosLog) ReadLog

func (self *PaxosLog) ReadLog(instanceId uint64) (string, error)

func (*PaxosLog) ReadState

func (self *PaxosLog) ReadState(instanceId uint64) (*common.AcceptorStateData, error)

func (*PaxosLog) WriteLog

func (self *PaxosLog) WriteLog(options WriteOptions, instanceId uint64, value string) error

func (*PaxosLog) WriteState

func (self *PaxosLog) WriteState(options WriteOptions, instanceId uint64, state common.AcceptorStateData) error

type SystemVariablesStore

type SystemVariablesStore struct {
	LogStorage *LogStorage
}

func NewSystemVariablesStore

func NewSystemVariablesStore(storage *LogStorage) *SystemVariablesStore

func (*SystemVariablesStore) Read

func (self *SystemVariablesStore) Read(groupIdx int32, variables *common.SystemVariables) error

func (*SystemVariablesStore) Write

func (self *SystemVariablesStore) Write(options WriteOptions, groupIdx int32, variables *common.SystemVariables) error

type ValueStore

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

func (*ValueStore) Append

func (self *ValueStore) Append(options WriteOptions, instanceId uint64, buffer []byte, fileIdStr *string) error

data file(data path/vpath/fileid.f) data format:

data len(int32)
value(data len) format:
  instance id(uint64)
  acceptor state data(data len - sizeof(uint64))

func (*ValueStore) Close

func (self *ValueStore) Close()

func (*ValueStore) DecodeFileId

func (self *ValueStore) DecodeFileId(fileIdStr string, fileId *int32, offset *uint64, cksum *uint32)

func (*ValueStore) Del

func (self *ValueStore) Del(fileIdStr string, instanceId uint64) error

func (*ValueStore) DeleteFile

func (self *ValueStore) DeleteFile(fileId int32) error

func (*ValueStore) EncodeFileId

func (self *ValueStore) EncodeFileId(fileId int32, offset uint64, cksum uint32, fileIdStr *string)

func (*ValueStore) ForceDel

func (self *ValueStore) ForceDel(fileIdStr string, instanceId uint64) error

func (*ValueStore) IncreaseFileId

func (self *ValueStore) IncreaseFileId() error

func (*ValueStore) Init

func (self *ValueStore) Init(path string, db *LogStorage) error

func (*ValueStore) OpenFile

func (self *ValueStore) OpenFile(fileId int32) (*os.File, error)

func (*ValueStore) Read

func (self *ValueStore) Read(fileIdstr string, instanceId *uint64) ([]byte, error)

func (*ValueStore) RebuildIndexForOneFile

func (self *ValueStore) RebuildIndexForOneFile(fileId int32, offset uint64, db *LogStorage, nowWriteOffset *uint64, nowInstanceId *uint64) error

type WriteOptions

type WriteOptions struct {
	Sync bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL