Documentation ¶
Overview ¶
Package cpp implements a C++11 wrapper to allow IStateMachine to be implemented in C++11.
This package is internally used by Dragonboat, applications are not expected to import this package.
Index ¶
- func AddManagedObject(object interface{}) uint64
- func AddToSnapshotFileCollection(oid uint64, fileID uint64, path []byte, metadata []byte)
- func DoneChanClosed(oid uint64) bool
- func GetManagedObject(oid uint64) (interface{}, bool)
- func GetManagedObjectCount() uint64
- func NewStateMachineWrapper(clusterID uint64, nodeID uint64, dsname string, done <-chan struct{}) rsm.IManagedStateMachine
- func ReadFromManagedReader(oid uint64, data []byte) (int, int)
- func RemoveManagedGoObject(oid uint64)
- func RemoveManagedObject(oid uint64)
- func WriteToManagedWriter(oid uint64, data []byte) (bool, int)
- type StateMachineWrapper
- func (ds *StateMachineWrapper) GetHash() uint64
- func (ds *StateMachineWrapper) Loaded(from rsm.From)
- func (ds *StateMachineWrapper) Lookup(data []byte) ([]byte, error)
- func (ds *StateMachineWrapper) Offloaded(from rsm.From)
- func (ds *StateMachineWrapper) RecoverFromSnapshot(fp string, files []statemachine.SnapshotFile) error
- func (ds *StateMachineWrapper) SaveSnapshot(fp string, collection statemachine.ISnapshotFileCollection) (uint64, error)
- func (ds *StateMachineWrapper) Update(session *rsm.Session, seriesID uint64, data []byte) uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddManagedObject ¶
func AddManagedObject(object interface{}) uint64
AddManagedObject adds the specified Go object to the managedObject collection so they can be access from foreign functions.
func AddToSnapshotFileCollection ¶
AddToSnapshotFileCollection adds the details of an external snapshot file to the specified managed file collection instance.
func DoneChanClosed ¶
DoneChanClosed is a go helper function exported to C to allow C code to check whether the specified done channel has been closed.
func GetManagedObject ¶
GetManagedObject returns the Go object specified by the oid value.
func GetManagedObjectCount ¶
func GetManagedObjectCount() uint64
GetManagedObjectCount returns the number of object in the managed objects collection.
func NewStateMachineWrapper ¶
func NewStateMachineWrapper(clusterID uint64, nodeID uint64, dsname string, done <-chan struct{}) rsm.IManagedStateMachine
NewStateMachineWrapper creates and returns the new NewStateMachineWrapper instance.
func ReadFromManagedReader ¶
ReadFromManagedReader is a go helper function exported to C to allow C code to use the Go snapshot reader.
func RemoveManagedGoObject ¶
func RemoveManagedGoObject(oid uint64)
RemoveManagedGoObject removes the managed object specified by the oid value.
func RemoveManagedObject ¶
func RemoveManagedObject(oid uint64)
RemoveManagedObject returns the object specified by the oid value from the managedObject collection.
Types ¶
type StateMachineWrapper ¶
type StateMachineWrapper struct { rsm.OffloadedStatus rsm.SessionManager // contains filtered or unexported fields }
StateMachineWrapper is the IManagedStateMachine managing C++ data store.
func (*StateMachineWrapper) GetHash ¶
func (ds *StateMachineWrapper) GetHash() uint64
GetHash returns an integer value representing the state of the data store.
func (*StateMachineWrapper) Loaded ¶
func (ds *StateMachineWrapper) Loaded(from rsm.From)
Loaded marks the data store as loaded by the specified component.
func (*StateMachineWrapper) Lookup ¶
func (ds *StateMachineWrapper) Lookup(data []byte) ([]byte, error)
Lookup queries the data store.
func (*StateMachineWrapper) Offloaded ¶
func (ds *StateMachineWrapper) Offloaded(from rsm.From)
Offloaded offloads the data store from the specified part of the system.
func (*StateMachineWrapper) RecoverFromSnapshot ¶
func (ds *StateMachineWrapper) RecoverFromSnapshot(fp string, files []statemachine.SnapshotFile) error
RecoverFromSnapshot recovers the state of the data store from the snapshot file specified by the fp input string.
func (*StateMachineWrapper) SaveSnapshot ¶
func (ds *StateMachineWrapper) SaveSnapshot(fp string, collection statemachine.ISnapshotFileCollection) (uint64, error)
SaveSnapshot saves the state of the data store to the snapshot file specified by the fp input string.