Documentation ¶
Index ¶
- Constants
- type LogStorage
- func (self *LogStorage) ClearAllLog() error
- func (self *LogStorage) Close()
- func (self *LogStorage) Del(options WriteOptions, instanceId uint64) error
- func (self *LogStorage) ForceDel(options WriteOptions, instanceId uint64) error
- func (self *LogStorage) Get(instanceId uint64) ([]byte, error)
- func (self *LogStorage) GetDBPath() string
- func (self *LogStorage) GetLogStorageDirPath() string
- func (self *LogStorage) GetMasterVariables() ([]byte, error)
- func (self *LogStorage) GetMaxInstanceID() (uint64, error)
- func (self *LogStorage) GetMaxInstanceIDFileID() (string, uint64, error)
- func (self *LogStorage) GetMinChosenInstanceID() (uint64, error)
- func (self *LogStorage) GetSystemVariables() ([]byte, error)
- func (self *LogStorage) Init(dbPath string) error
- func (self *LogStorage) Put(options WriteOptions, instanceId uint64, value []byte) error
- func (self *LogStorage) SetMasterVariables(options WriteOptions, buffer []byte) error
- func (self *LogStorage) SetMinChosenInstanceID(minInstanceId uint64) error
- func (self *LogStorage) SetSystemVariables(options WriteOptions, buffer []byte) error
- type PaxosComparator
- type PaxosLog
- func (self *PaxosLog) GetMaxInstanceIdFromLog() (uint64, error)
- func (self *PaxosLog) ReadLog(instanceId uint64) (string, error)
- func (self *PaxosLog) ReadState(instanceId uint64) (*common.AcceptorStateData, error)
- func (self *PaxosLog) WriteLog(options WriteOptions, instanceId uint64, value string) error
- func (self *PaxosLog) WriteState(options WriteOptions, instanceId uint64, state common.AcceptorStateData) error
- type SystemVariablesStore
- type ValueStore
- func (self *ValueStore) Append(options WriteOptions, instanceId uint64, buffer []byte, fileIdStr *string) error
- func (self *ValueStore) Close()
- func (self *ValueStore) DecodeFileId(fileIdStr string, fileId *int32, offset *uint64, cksum *uint32)
- func (self *ValueStore) Del(fileIdStr string, instanceId uint64) error
- func (self *ValueStore) DeleteFile(fileId int32) error
- func (self *ValueStore) EncodeFileId(fileId int32, offset uint64, cksum uint32, fileIdStr *string)
- func (self *ValueStore) ForceDel(fileIdStr string, instanceId uint64) error
- func (self *ValueStore) IncreaseFileId() error
- func (self *ValueStore) Init(path string, db *LogStorage) error
- func (self *ValueStore) OpenFile(fileId int32) (*os.File, error)
- func (self *ValueStore) Read(fileIdstr string, instanceId *uint64) ([]byte, error)
- func (self *ValueStore) RebuildIndexForOneFile(fileId int32, offset uint64, db *LogStorage, nowWriteOffset *uint64, ...) error
- type WriteOptions
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) 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 ¶
common.ErrKeyNotFound or nil
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) 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) 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
}
Click to show internal directories.
Click to hide internal directories.