cpp

package
v3.2.7-0...-70c9be9 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 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

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

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

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

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

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

ConcurrentStateMachineWrapper ...

func (*ConcurrentStateMachineWrapper) BatchedUpdate

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

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

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

Sync ...

func (*ConcurrentStateMachineWrapper) Update

Update ...

type OnDiskStateMachineWrapper

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

OnDiskStateMachineWrapper ...

func (*OnDiskStateMachineWrapper) BatchedUpdate

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

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 ...

func (*OnDiskStateMachineWrapper) Sync

func (ds *OnDiskStateMachineWrapper) Sync() error

Sync ...

func (*OnDiskStateMachineWrapper) Update

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

Update ...

type RegularStateMachineWrapper

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

RegularStateMachineWrapper is the IManagedStateMachine managing C++ data store.

func (*RegularStateMachineWrapper) BatchedUpdate

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

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.

func (*RegularStateMachineWrapper) Update

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