cpp

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

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

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

func AddToSnapshotFileCollection(oid uint64,
	fileID uint64, path []byte, metadata []byte)

AddToSnapshotFileCollection adds the details of an external snapshot file to the specified managed file collection instance.

func DoneChanClosed

func DoneChanClosed(oid uint64) bool

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

func GetManagedObject(oid uint64) (interface{}, bool)

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

func ReadFromManagedReader(oid uint64, data []byte) (int, int)

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.

func WriteToManagedWriter

func WriteToManagedWriter(oid uint64, data []byte) (bool, int)

WriteToManagedWriter is a go helper function exported to C code to allow C code to use the Go snapshot writer.

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.

func (*StateMachineWrapper) Update

func (ds *StateMachineWrapper) Update(session *rsm.Session, seriesID uint64,
	data []byte) uint64

Update updates the data store.

Jump to

Keyboard shortcuts

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