cpp

package
v3.2.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 14 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 AddManagedObjects added in v3.2.0

func AddManagedObjects(objects ...interface{}) []uint64

AddManagedObjects ...

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 NewRaftEventListener added in v3.2.0

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 added in v3.2.0

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

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 RemoveManagedObjects added in v3.2.0

func RemoveManagedObjects(oids ...uint64)

RemoveManagedObjects ...

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 ConcurrentStateMachineWrapper added in v3.2.0

type ConcurrentStateMachineWrapper struct {
	rsm.OffloadedStatus
	// contains filtered or unexported fields
}

ConcurrentStateMachineWrapper ...

func (*ConcurrentStateMachineWrapper) BatchedUpdate added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) BatchedUpdate(entries []sm.Entry) ([]sm.Entry, error)

BatchedUpdate ...

func (*ConcurrentStateMachineWrapper) ConcurrentSnapshot added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) ConcurrentSnapshot() bool

ConcurrentSnapshot ...

func (*ConcurrentStateMachineWrapper) GetHash added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) GetHash() (uint64, error)

GetHash ...

func (*ConcurrentStateMachineWrapper) Loaded added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) Loaded(from rsm.From)

Loaded ...

func (*ConcurrentStateMachineWrapper) Lookup added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) Lookup(query interface{}) (interface{}, error)

Lookup ...

func (*ConcurrentStateMachineWrapper) NALookup added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) NALookup(query []byte) ([]byte, error)

NALookup ...

func (*ConcurrentStateMachineWrapper) Offloaded added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) Offloaded(from rsm.From) bool

Offloaded ...

func (*ConcurrentStateMachineWrapper) OnDiskStateMachine added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) OnDiskStateMachine() bool

OnDiskStateMachine ...

func (*ConcurrentStateMachineWrapper) Open added in v3.2.0

Open ...

func (*ConcurrentStateMachineWrapper) PrepareSnapshot added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) PrepareSnapshot() (interface{}, error)

PrepareSnapshot ...

func (*ConcurrentStateMachineWrapper) RecoverFromSnapshot added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) RecoverFromSnapshot(
	reader io.Reader, files []sm.SnapshotFile) error

RecoverFromSnapshot ...

func (*ConcurrentStateMachineWrapper) SaveSnapshot added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) SaveSnapshot(meta *rsm.SSMeta,
	writer io.Writer, session []byte,
	collection sm.ISnapshotFileCollection) (bool, error)

SaveSnapshot ...

func (*ConcurrentStateMachineWrapper) StateMachineType added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) StateMachineType() pb.StateMachineType

StateMachineType ...

func (*ConcurrentStateMachineWrapper) StreamSnapshot added in v3.2.0

func (ds *ConcurrentStateMachineWrapper) StreamSnapshot(ssctx interface{},
	writer io.Writer) error

StreamSnapshot ...

func (*ConcurrentStateMachineWrapper) Sync added in v3.2.0

Sync ...

func (*ConcurrentStateMachineWrapper) Update added in v3.2.0

Update ...

type OnDiskStateMachineWrapper added in v3.2.0

type OnDiskStateMachineWrapper struct {
	rsm.OffloadedStatus
	// contains filtered or unexported fields
}

OnDiskStateMachineWrapper ...

func (*OnDiskStateMachineWrapper) BatchedUpdate added in v3.2.0

func (ds *OnDiskStateMachineWrapper) BatchedUpdate(entries []sm.Entry) ([]sm.Entry, error)

BatchedUpdate ...

func (*OnDiskStateMachineWrapper) ConcurrentSnapshot added in v3.2.0

func (ds *OnDiskStateMachineWrapper) ConcurrentSnapshot() bool

ConcurrentSnapshot ...

func (*OnDiskStateMachineWrapper) GetHash added in v3.2.0

func (ds *OnDiskStateMachineWrapper) GetHash() (uint64, error)

GetHash ...

func (*OnDiskStateMachineWrapper) Loaded added in v3.2.0

func (ds *OnDiskStateMachineWrapper) Loaded(from rsm.From)

Loaded ...

func (*OnDiskStateMachineWrapper) Lookup added in v3.2.0

func (ds *OnDiskStateMachineWrapper) Lookup(query interface{}) (interface{}, error)

Lookup ...

func (*OnDiskStateMachineWrapper) NALookup added in v3.2.0

func (ds *OnDiskStateMachineWrapper) NALookup(query []byte) ([]byte, error)

NALookup ...

func (*OnDiskStateMachineWrapper) Offloaded added in v3.2.0

func (ds *OnDiskStateMachineWrapper) Offloaded(from rsm.From) bool

Offloaded ...

func (*OnDiskStateMachineWrapper) OnDiskStateMachine added in v3.2.0

func (ds *OnDiskStateMachineWrapper) OnDiskStateMachine() bool

OnDiskStateMachine ...

func (*OnDiskStateMachineWrapper) Open added in v3.2.0

func (ds *OnDiskStateMachineWrapper) Open() (uint64, error)

Open ...

func (*OnDiskStateMachineWrapper) PrepareSnapshot added in v3.2.0

func (ds *OnDiskStateMachineWrapper) PrepareSnapshot() (interface{}, error)

PrepareSnapshot ...

func (*OnDiskStateMachineWrapper) RecoverFromSnapshot added in v3.2.0

func (ds *OnDiskStateMachineWrapper) RecoverFromSnapshot(
	reader io.Reader, files []sm.SnapshotFile) error

RecoverFromSnapshot ...

func (*OnDiskStateMachineWrapper) SaveSnapshot added in v3.2.0

func (ds *OnDiskStateMachineWrapper) SaveSnapshot(meta *rsm.SSMeta,
	writer io.Writer, session []byte,
	collection sm.ISnapshotFileCollection) (bool, error)

SaveSnapshot ...

func (*OnDiskStateMachineWrapper) StateMachineType added in v3.2.0

func (ds *OnDiskStateMachineWrapper) StateMachineType() pb.StateMachineType

StateMachineType ...

func (*OnDiskStateMachineWrapper) StreamSnapshot added in v3.2.0

func (ds *OnDiskStateMachineWrapper) StreamSnapshot(ssctx interface{},
	writer io.Writer) error

StreamSnapshot ...

func (*OnDiskStateMachineWrapper) Sync added in v3.2.0

func (ds *OnDiskStateMachineWrapper) Sync() error

Sync ...

func (*OnDiskStateMachineWrapper) Update added in v3.2.0

func (ds *OnDiskStateMachineWrapper) Update(e sm.Entry) (sm.Result, error)

Update ...

type RegularStateMachineWrapper added in v3.2.0

type RegularStateMachineWrapper struct {
	rsm.OffloadedStatus
	// contains filtered or unexported fields
}

RegularStateMachineWrapper is the IManagedStateMachine managing C++ data store.

func (*RegularStateMachineWrapper) BatchedUpdate added in v3.2.0

func (ds *RegularStateMachineWrapper) BatchedUpdate(entries []sm.Entry) ([]sm.Entry, error)

BatchedUpdate updates the data store in batches.

func (*RegularStateMachineWrapper) ConcurrentSnapshot added in v3.2.0

func (ds *RegularStateMachineWrapper) ConcurrentSnapshot() bool

ConcurrentSnapshot returns a boolean flag indicating whether the state machine is capable of taking concurrent snapshots.

func (*RegularStateMachineWrapper) GetHash added in v3.2.0

func (ds *RegularStateMachineWrapper) GetHash() (uint64, error)

GetHash returns an integer value representing the state of the data store.

func (*RegularStateMachineWrapper) Loaded added in v3.2.0

func (ds *RegularStateMachineWrapper) Loaded(from rsm.From)

Loaded marks the data store as loaded by the specified component.

func (*RegularStateMachineWrapper) Lookup added in v3.2.0

func (ds *RegularStateMachineWrapper) Lookup(query interface{}) (interface{}, error)

Lookup queries the data store.

func (*RegularStateMachineWrapper) NALookup added in v3.2.0

func (ds *RegularStateMachineWrapper) NALookup(query []byte) ([]byte, error)

NALookup queries the data store.

func (*RegularStateMachineWrapper) Offloaded added in v3.2.0

func (ds *RegularStateMachineWrapper) Offloaded(from rsm.From) bool

Offloaded offloads the data store from the specified part of the system.

func (*RegularStateMachineWrapper) OnDiskStateMachine added in v3.2.0

func (ds *RegularStateMachineWrapper) OnDiskStateMachine() bool

OnDiskStateMachine returns a boolean flag indicating whether the state machine is an on disk state machine.

func (*RegularStateMachineWrapper) Open added in v3.2.0

func (ds *RegularStateMachineWrapper) Open() (uint64, error)

Open opens the state machine.

func (*RegularStateMachineWrapper) PrepareSnapshot added in v3.2.0

func (ds *RegularStateMachineWrapper) PrepareSnapshot() (interface{}, error)

PrepareSnapshot makes preparations for taking concurrent snapshot.

func (*RegularStateMachineWrapper) RecoverFromSnapshot added in v3.2.0

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 added in v3.2.0

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 added in v3.2.0

func (ds *RegularStateMachineWrapper) StateMachineType() pb.StateMachineType

StateMachineType returns the state machine type.

func (*RegularStateMachineWrapper) StreamSnapshot added in v3.2.0

func (ds *RegularStateMachineWrapper) StreamSnapshot(ssctx interface{},
	writer io.Writer) error

StreamSnapshot streams the snapshot to the remote node.

func (*RegularStateMachineWrapper) Sync added in v3.2.0

func (ds *RegularStateMachineWrapper) Sync() error

Sync synchronizes the state machine's in-core state with that on disk.

func (*RegularStateMachineWrapper) Update added in v3.2.0

func (ds *RegularStateMachineWrapper) Update(e sm.Entry) (sm.Result, error)

Update updates the data store.

Jump to

Keyboard shortcuts

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