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 AddManagedObjects(objects ...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 NewRaftEventListener(listener unsafe.Pointer) raftio.IRaftEventListener
- func NewStateMachineWrapper(clusterID uint64, nodeID uint64, factory unsafe.Pointer, style uint64, ...) rsm.IManagedStateMachine
- func NewStateMachineWrapperFromPlugin(clusterID uint64, nodeID uint64, dsname string, fname string, ...) rsm.IManagedStateMachine
- func ReadFromManagedReader(oid uint64, data []byte) (int, int)
- func RemoveManagedGoObject(oid uint64)
- func RemoveManagedObject(oid uint64)
- func RemoveManagedObjects(oids ...uint64)
- func WriteToManagedWriter(oid uint64, data []byte) (bool, int)
- type ConcurrentStateMachineWrapper
- func (ds *ConcurrentStateMachineWrapper) BatchedUpdate(entries []sm.Entry) ([]sm.Entry, error)
- func (ds *ConcurrentStateMachineWrapper) ConcurrentSnapshot() bool
- func (ds *ConcurrentStateMachineWrapper) GetHash() (uint64, error)
- func (ds *ConcurrentStateMachineWrapper) Loaded(from rsm.From)
- func (ds *ConcurrentStateMachineWrapper) Lookup(query interface{}) (interface{}, error)
- func (ds *ConcurrentStateMachineWrapper) NALookup(query []byte) ([]byte, error)
- func (ds *ConcurrentStateMachineWrapper) Offloaded(from rsm.From) bool
- func (ds *ConcurrentStateMachineWrapper) OnDiskStateMachine() bool
- func (ds *ConcurrentStateMachineWrapper) Open() (uint64, error)
- func (ds *ConcurrentStateMachineWrapper) PrepareSnapshot() (interface{}, error)
- func (ds *ConcurrentStateMachineWrapper) RecoverFromSnapshot(reader io.Reader, files []sm.SnapshotFile) error
- func (ds *ConcurrentStateMachineWrapper) SaveSnapshot(meta *rsm.SSMeta, writer io.Writer, session []byte, ...) (bool, error)
- func (ds *ConcurrentStateMachineWrapper) StateMachineType() pb.StateMachineType
- func (ds *ConcurrentStateMachineWrapper) StreamSnapshot(ssctx interface{}, writer io.Writer) error
- func (ds *ConcurrentStateMachineWrapper) Sync() error
- func (ds *ConcurrentStateMachineWrapper) Update(e sm.Entry) (sm.Result, error)
- type OnDiskStateMachineWrapper
- func (ds *OnDiskStateMachineWrapper) BatchedUpdate(entries []sm.Entry) ([]sm.Entry, error)
- func (ds *OnDiskStateMachineWrapper) ConcurrentSnapshot() bool
- func (ds *OnDiskStateMachineWrapper) GetHash() (uint64, error)
- func (ds *OnDiskStateMachineWrapper) Loaded(from rsm.From)
- func (ds *OnDiskStateMachineWrapper) Lookup(query interface{}) (interface{}, error)
- func (ds *OnDiskStateMachineWrapper) NALookup(query []byte) ([]byte, error)
- func (ds *OnDiskStateMachineWrapper) Offloaded(from rsm.From) bool
- func (ds *OnDiskStateMachineWrapper) OnDiskStateMachine() bool
- func (ds *OnDiskStateMachineWrapper) Open() (uint64, error)
- func (ds *OnDiskStateMachineWrapper) PrepareSnapshot() (interface{}, error)
- func (ds *OnDiskStateMachineWrapper) RecoverFromSnapshot(reader io.Reader, files []sm.SnapshotFile) error
- func (ds *OnDiskStateMachineWrapper) SaveSnapshot(meta *rsm.SSMeta, writer io.Writer, session []byte, ...) (bool, error)
- func (ds *OnDiskStateMachineWrapper) StateMachineType() pb.StateMachineType
- func (ds *OnDiskStateMachineWrapper) StreamSnapshot(ssctx interface{}, writer io.Writer) error
- func (ds *OnDiskStateMachineWrapper) Sync() error
- func (ds *OnDiskStateMachineWrapper) Update(e sm.Entry) (sm.Result, error)
- type RegularStateMachineWrapper
- func (ds *RegularStateMachineWrapper) BatchedUpdate(entries []sm.Entry) ([]sm.Entry, error)
- func (ds *RegularStateMachineWrapper) ConcurrentSnapshot() bool
- func (ds *RegularStateMachineWrapper) GetHash() (uint64, error)
- func (ds *RegularStateMachineWrapper) Loaded(from rsm.From)
- func (ds *RegularStateMachineWrapper) Lookup(query interface{}) (interface{}, error)
- func (ds *RegularStateMachineWrapper) NALookup(query []byte) ([]byte, error)
- func (ds *RegularStateMachineWrapper) Offloaded(from rsm.From) bool
- func (ds *RegularStateMachineWrapper) OnDiskStateMachine() bool
- func (ds *RegularStateMachineWrapper) Open() (uint64, error)
- func (ds *RegularStateMachineWrapper) PrepareSnapshot() (interface{}, error)
- func (ds *RegularStateMachineWrapper) RecoverFromSnapshot(reader io.Reader, files []sm.SnapshotFile) error
- func (ds *RegularStateMachineWrapper) SaveSnapshot(meta *rsm.SSMeta, writer io.Writer, session []byte, ...) (bool, error)
- func (ds *RegularStateMachineWrapper) StateMachineType() pb.StateMachineType
- func (ds *RegularStateMachineWrapper) StreamSnapshot(ssctx interface{}, writer io.Writer) error
- func (ds *RegularStateMachineWrapper) Sync() error
- func (ds *RegularStateMachineWrapper) Update(e sm.Entry) (sm.Result, error)
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 AddManagedObjects ¶
func AddManagedObjects(objects ...interface{}) []uint64
AddManagedObjects ...
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 NewRaftEventListener ¶
func NewRaftEventListener( listener unsafe.Pointer) raftio.IRaftEventListener
NewRaftEventListener creates and returns the new raftio.IRaftEventListener instance to handle cpp listener.
func NewStateMachineWrapper ¶
func NewStateMachineWrapper(clusterID uint64, nodeID uint64, factory unsafe.Pointer, style uint64, smType pb.StateMachineType, done <-chan struct{}) rsm.IManagedStateMachine
NewStateMachineWrapper creates and returns the new NewStateMachineWrapper instance.
func NewStateMachineWrapperFromPlugin ¶
func NewStateMachineWrapperFromPlugin(clusterID uint64, nodeID uint64, dsname string, fname string, smType pb.StateMachineType, done <-chan struct{}) rsm.IManagedStateMachine
NewStateMachineWrapperFromPlugin creates and returns the new plugin based 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 ConcurrentStateMachineWrapper ¶
type ConcurrentStateMachineWrapper struct { rsm.OffloadedStatus // contains filtered or unexported fields }
ConcurrentStateMachineWrapper ...
func (*ConcurrentStateMachineWrapper) BatchedUpdate ¶
BatchedUpdate ...
func (*ConcurrentStateMachineWrapper) ConcurrentSnapshot ¶
func (ds *ConcurrentStateMachineWrapper) ConcurrentSnapshot() bool
ConcurrentSnapshot ...
func (*ConcurrentStateMachineWrapper) GetHash ¶
func (ds *ConcurrentStateMachineWrapper) GetHash() (uint64, error)
GetHash ...
func (*ConcurrentStateMachineWrapper) Loaded ¶
func (ds *ConcurrentStateMachineWrapper) Loaded(from rsm.From)
Loaded ...
func (*ConcurrentStateMachineWrapper) Lookup ¶
func (ds *ConcurrentStateMachineWrapper) Lookup(query interface{}) (interface{}, error)
Lookup ...
func (*ConcurrentStateMachineWrapper) NALookup ¶
func (ds *ConcurrentStateMachineWrapper) NALookup(query []byte) ([]byte, error)
NALookup ...
func (*ConcurrentStateMachineWrapper) Offloaded ¶
func (ds *ConcurrentStateMachineWrapper) Offloaded(from rsm.From) bool
Offloaded ...
func (*ConcurrentStateMachineWrapper) OnDiskStateMachine ¶
func (ds *ConcurrentStateMachineWrapper) OnDiskStateMachine() bool
OnDiskStateMachine ...
func (*ConcurrentStateMachineWrapper) Open ¶
func (ds *ConcurrentStateMachineWrapper) Open() (uint64, error)
Open ...
func (*ConcurrentStateMachineWrapper) PrepareSnapshot ¶
func (ds *ConcurrentStateMachineWrapper) PrepareSnapshot() (interface{}, error)
PrepareSnapshot ...
func (*ConcurrentStateMachineWrapper) RecoverFromSnapshot ¶
func (ds *ConcurrentStateMachineWrapper) RecoverFromSnapshot( reader io.Reader, files []sm.SnapshotFile) error
RecoverFromSnapshot ...
func (*ConcurrentStateMachineWrapper) SaveSnapshot ¶
func (ds *ConcurrentStateMachineWrapper) SaveSnapshot(meta *rsm.SSMeta, writer io.Writer, session []byte, collection sm.ISnapshotFileCollection) (bool, error)
SaveSnapshot ...
func (*ConcurrentStateMachineWrapper) StateMachineType ¶
func (ds *ConcurrentStateMachineWrapper) StateMachineType() pb.StateMachineType
StateMachineType ...
func (*ConcurrentStateMachineWrapper) StreamSnapshot ¶
func (ds *ConcurrentStateMachineWrapper) StreamSnapshot(ssctx interface{}, writer io.Writer) error
StreamSnapshot ...
func (*ConcurrentStateMachineWrapper) Sync ¶
func (ds *ConcurrentStateMachineWrapper) Sync() error
Sync ...
type OnDiskStateMachineWrapper ¶
type OnDiskStateMachineWrapper struct { rsm.OffloadedStatus // contains filtered or unexported fields }
OnDiskStateMachineWrapper ...
func (*OnDiskStateMachineWrapper) BatchedUpdate ¶
BatchedUpdate ...
func (*OnDiskStateMachineWrapper) ConcurrentSnapshot ¶
func (ds *OnDiskStateMachineWrapper) ConcurrentSnapshot() bool
ConcurrentSnapshot ...
func (*OnDiskStateMachineWrapper) GetHash ¶
func (ds *OnDiskStateMachineWrapper) GetHash() (uint64, error)
GetHash ...
func (*OnDiskStateMachineWrapper) Loaded ¶
func (ds *OnDiskStateMachineWrapper) Loaded(from rsm.From)
Loaded ...
func (*OnDiskStateMachineWrapper) Lookup ¶
func (ds *OnDiskStateMachineWrapper) Lookup(query interface{}) (interface{}, error)
Lookup ...
func (*OnDiskStateMachineWrapper) NALookup ¶
func (ds *OnDiskStateMachineWrapper) NALookup(query []byte) ([]byte, error)
NALookup ...
func (*OnDiskStateMachineWrapper) Offloaded ¶
func (ds *OnDiskStateMachineWrapper) Offloaded(from rsm.From) bool
Offloaded ...
func (*OnDiskStateMachineWrapper) OnDiskStateMachine ¶
func (ds *OnDiskStateMachineWrapper) OnDiskStateMachine() bool
OnDiskStateMachine ...
func (*OnDiskStateMachineWrapper) Open ¶
func (ds *OnDiskStateMachineWrapper) Open() (uint64, error)
Open ...
func (*OnDiskStateMachineWrapper) PrepareSnapshot ¶
func (ds *OnDiskStateMachineWrapper) PrepareSnapshot() (interface{}, error)
PrepareSnapshot ...
func (*OnDiskStateMachineWrapper) RecoverFromSnapshot ¶
func (ds *OnDiskStateMachineWrapper) RecoverFromSnapshot( reader io.Reader, files []sm.SnapshotFile) error
RecoverFromSnapshot ...
func (*OnDiskStateMachineWrapper) SaveSnapshot ¶
func (ds *OnDiskStateMachineWrapper) SaveSnapshot(meta *rsm.SSMeta, writer io.Writer, session []byte, collection sm.ISnapshotFileCollection) (bool, error)
SaveSnapshot ...
func (*OnDiskStateMachineWrapper) StateMachineType ¶
func (ds *OnDiskStateMachineWrapper) StateMachineType() pb.StateMachineType
StateMachineType ...
func (*OnDiskStateMachineWrapper) StreamSnapshot ¶
func (ds *OnDiskStateMachineWrapper) StreamSnapshot(ssctx interface{}, writer io.Writer) error
StreamSnapshot ...
type RegularStateMachineWrapper ¶
type RegularStateMachineWrapper struct { rsm.OffloadedStatus // contains filtered or unexported fields }
RegularStateMachineWrapper is the IManagedStateMachine managing C++ data store.
func (*RegularStateMachineWrapper) BatchedUpdate ¶
BatchedUpdate updates the data store in batches.
func (*RegularStateMachineWrapper) ConcurrentSnapshot ¶
func (ds *RegularStateMachineWrapper) ConcurrentSnapshot() bool
ConcurrentSnapshot returns a boolean flag indicating whether the state machine is capable of taking concurrent snapshots.
func (*RegularStateMachineWrapper) GetHash ¶
func (ds *RegularStateMachineWrapper) GetHash() (uint64, error)
GetHash returns an integer value representing the state of the data store.
func (*RegularStateMachineWrapper) Loaded ¶
func (ds *RegularStateMachineWrapper) Loaded(from rsm.From)
Loaded marks the data store as loaded by the specified component.
func (*RegularStateMachineWrapper) Lookup ¶
func (ds *RegularStateMachineWrapper) Lookup(query interface{}) (interface{}, error)
Lookup queries the data store.
func (*RegularStateMachineWrapper) NALookup ¶
func (ds *RegularStateMachineWrapper) NALookup(query []byte) ([]byte, error)
NALookup queries the data store.
func (*RegularStateMachineWrapper) Offloaded ¶
func (ds *RegularStateMachineWrapper) Offloaded(from rsm.From) bool
Offloaded offloads the data store from the specified part of the system.
func (*RegularStateMachineWrapper) OnDiskStateMachine ¶
func (ds *RegularStateMachineWrapper) OnDiskStateMachine() bool
OnDiskStateMachine returns a boolean flag indicating whether the state machine is an on disk state machine.
func (*RegularStateMachineWrapper) Open ¶
func (ds *RegularStateMachineWrapper) Open() (uint64, error)
Open opens the state machine.
func (*RegularStateMachineWrapper) PrepareSnapshot ¶
func (ds *RegularStateMachineWrapper) PrepareSnapshot() (interface{}, error)
PrepareSnapshot makes preparations for taking concurrent snapshot.
func (*RegularStateMachineWrapper) RecoverFromSnapshot ¶
func (ds *RegularStateMachineWrapper) RecoverFromSnapshot( reader io.Reader, files []sm.SnapshotFile) error
RecoverFromSnapshot recovers the state of the data store from the snapshot file specified by the fp input string.
func (*RegularStateMachineWrapper) SaveSnapshot ¶
func (ds *RegularStateMachineWrapper) SaveSnapshot(meta *rsm.SSMeta, writer io.Writer, session []byte, collection sm.ISnapshotFileCollection) (bool, error)
SaveSnapshot saves the state of the data store to the snapshot file specified by the fp input string.
func (*RegularStateMachineWrapper) StateMachineType ¶
func (ds *RegularStateMachineWrapper) StateMachineType() pb.StateMachineType
StateMachineType returns the state machine type.
func (*RegularStateMachineWrapper) StreamSnapshot ¶
func (ds *RegularStateMachineWrapper) StreamSnapshot(ssctx interface{}, writer io.Writer) error
StreamSnapshot streams the snapshot to the remote node.
func (*RegularStateMachineWrapper) Sync ¶
func (ds *RegularStateMachineWrapper) Sync() error
Sync synchronizes the state machine's in-core state with that on disk.