Documentation ¶
Index ¶
- func Deterministic(opts *simFactory) error
- func DisableAnchorHealing(opts *simFactory) error
- func DropDispatchedMessages(opts *simFactory) error
- func DropInitialAnchor(opts *simFactory) error
- func DumpRecording(rd ioutil.SectionReader) error
- func IgnoreCommitResults(opts *simFactory) error
- func IgnoreDeliverResults(opts *simFactory) error
- func MemoryDatabase(*simFactory) error
- func NewLocalNetwork(name string, bvnCount, nodeCount int, baseIP net.IP, basePort uint64) *accumulated.NetworkInit
- func NewSimpleNetwork(name string, bvnCount, nodeCount int) *accumulated.NetworkInit
- func SkipProposalCheck(opts *simFactory) error
- type BlockHookFunc
- type ListenOptions
- type Node
- func (n *Node) ConsensusStatus(ctx context.Context, opts api.ConsensusStatusOptions) (*api.ConsensusStatus, error)
- func (n *Node) Submit(ctx context.Context, envelope *messaging.Envelope, opts api.SubmitOptions) ([]*api.Submission, error)
- func (n *Node) Validate(ctx context.Context, envelope *messaging.Envelope, opts api.ValidateOptions) ([]*api.Submission, error)
- type NodeBlockHookFunc
- type OpenDatabaseFunc
- type Option
- func BadgerDatabaseFromDirectory(dir string, onErr func(error)) Option
- func CaptureDispatchedMessages(fn dispatchInterceptor) Option
- func Genesis(time time.Time) Option
- func GenesisWith(time time.Time, values *core.GlobalValues) Option
- func GenesisWithVersion(time time.Time, version protocol.ExecutorVersion) Option
- func InitialAcmeSupply(v *big.Int) Option
- func LocalNetwork(name string, bvnCount, nodeCount int, baseIP net.IP, basePort uint64) Option
- func SimpleNetwork(name string, bvnCount, nodeCount int) Option
- func SnapshotFromDirectory(dir string) Option
- func SnapshotMap(snapshots map[string][]byte) Option
- func WithDatabase(fn OpenDatabaseFunc) Option
- func WithLogger(logger log.Logger) Option
- func WithNetwork(net *accumulated.NetworkInit) Option
- func WithRecordings(fn RecordingFunc) Option
- func WithSnapshot(fn SnapshotFunc) Option
- type Partition
- func (p *Partition) Begin(writable bool) *database.Batch
- func (p *Partition) SetBlockHook(fn BlockHookFunc)
- func (p *Partition) SetNodeBlockHook(fn NodeBlockHookFunc)
- func (p *Partition) SetObserver(observer database.Observer)
- func (p *Partition) SetSubmitHook(fn SubmitHookFunc)
- func (p *Partition) Submit(envelope *messaging.Envelope, pretend bool) ([]*protocol.TransactionStatus, error)
- func (p *Partition) Update(fn func(*database.Batch) error) error
- func (p *Partition) View(fn func(*database.Batch) error) error
- type RecordingFunc
- type ResponseSubmit
- type Router
- type Simulator
- func (s *Simulator) BlockIndex(partition string) uint64
- func (s *Simulator) BlockIndexFor(account *url.URL) uint64
- func (s *Simulator) ClientV2(part string) *client.Client
- func (s *Simulator) Collect(partition string, file io.WriteSeeker, opts *database.CollectOptions) error
- func (s *Simulator) Database(partition string) database.Beginner
- func (s *Simulator) DatabaseFor(account *url.URL) database.Updater
- func (s *Simulator) EventBus(partition string) *events.Bus
- func (s *Simulator) ListenAndServe(ctx context.Context, opts ListenOptions) (err error)
- func (s *Simulator) NewDirectClientWithHook(hook func(http.Handler) http.Handler) *client.Client
- func (s *Simulator) Partition(partition string) *Partition
- func (s *Simulator) Partitions() []*protocol.PartitionInfo
- func (s *Simulator) Router() *Router
- func (s *Simulator) Services() *message.Client
- func (s *Simulator) SetBlockHook(partition string, fn BlockHookFunc)
- func (s *Simulator) SetBlockHookFor(account *url.URL, fn BlockHookFunc)
- func (s *Simulator) SetNodeBlockHook(partition string, fn NodeBlockHookFunc)
- func (s *Simulator) SetNodeBlockHookFor(account *url.URL, fn NodeBlockHookFunc)
- func (s *Simulator) SetRoute(account *url.URL, partition string)
- func (s *Simulator) SetSubmitHook(partition string, fn SubmitHookFunc)
- func (s *Simulator) SetSubmitHookFor(account *url.URL, fn SubmitHookFunc)
- func (s *Simulator) SignWithNode(partition string, i int) nodeSigner
- func (s *Simulator) Step() error
- func (s *Simulator) Submit(envelope *messaging.Envelope) ([]*protocol.TransactionStatus, error)
- func (s *Simulator) SubmitTo(partition string, envelope *messaging.Envelope) ([]*protocol.TransactionStatus, error)
- func (s *Simulator) ViewAll(fn func(batch *database.Batch) error) error
- type SnapshotFunc
- type SubmitHookFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deterministic ¶ added in v1.2.10
func Deterministic(opts *simFactory) error
Deterministic attempts to run the simulator in a fully deterministic, repeatable way.
func DisableAnchorHealing ¶ added in v1.2.10
func DisableAnchorHealing(opts *simFactory) error
DisableAnchorHealing disables healing of anchors after they are initially submitted.
func DropDispatchedMessages ¶ added in v1.2.10
func DropDispatchedMessages(opts *simFactory) error
DropDispatchedMessages drops all internally dispatched messages.
func DropInitialAnchor ¶ added in v1.2.10
func DropInitialAnchor(opts *simFactory) error
DropInitialAnchor drops anchors when they are initially submitted.
func DumpRecording ¶ added in v1.2.0
func DumpRecording(rd ioutil.SectionReader) error
func IgnoreCommitResults ¶ added in v1.2.10
func IgnoreCommitResults(opts *simFactory) error
IgnoreCommitResults ignores inconsistencies in the result of Commit.
func IgnoreDeliverResults ¶ added in v1.2.10
func IgnoreDeliverResults(opts *simFactory) error
IgnoreDeliverResults ignores inconsistencies in the result of DeliverTx.
func MemoryDatabase ¶
func MemoryDatabase(*simFactory) error
MemoryDatabase configures the simulator to use in-memory databases.
func NewLocalNetwork ¶ added in v1.1.1
func NewLocalNetwork(name string, bvnCount, nodeCount int, baseIP net.IP, basePort uint64) *accumulated.NetworkInit
NewLocalNetwork returns a SimpleNetwork with sequential IPs starting from the base IP with the given base port.
func NewSimpleNetwork ¶ added in v1.1.1
func NewSimpleNetwork(name string, bvnCount, nodeCount int) *accumulated.NetworkInit
NewSimpleNetwork creates a basic network with the given name, number of BVNs, and number of nodes per BVN.
func SkipProposalCheck ¶ added in v1.2.10
func SkipProposalCheck(opts *simFactory) error
SkipProposalCheck skips checking if each non-leader node agrees with the leader's proposed block.
Types ¶
type BlockHookFunc ¶ added in v1.1.0
type ListenOptions ¶ added in v1.1.0
type ListenOptions struct { // ListenHTTPv2 enables API v2 over HTTP. ListenHTTPv2 bool // ListenHTTPv3 enables API v3 over HTTP. ListenHTTPv3 bool // ListenWSv3 enables API v3 over WebSockets. ListenWSv3 bool // ListenP2Pv3 enables API v3 over libp2p. ListenP2Pv3 bool // HookHTTP hooks into HTTP calls. HookHTTP func(http.Handler, http.ResponseWriter, *http.Request) // ServeError handles errors produced by http.Server.Serve. If Error is nil, // ListenAndServe will panic if http.Server.Serve returns an error. ServeError func(error) }
ListenOptions are options for Simulator.ListenAndServe.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) ConsensusStatus ¶ added in v1.2.10
func (n *Node) ConsensusStatus(ctx context.Context, opts api.ConsensusStatusOptions) (*api.ConsensusStatus, error)
ConsensusStatus implements api.ConsensusService.
type NodeBlockHookFunc ¶ added in v1.1.1
type OpenDatabaseFunc ¶
type Option ¶ added in v1.1.1
type Option func(*simFactory) error
func CaptureDispatchedMessages ¶ added in v1.2.10
func CaptureDispatchedMessages(fn dispatchInterceptor) Option
CaptureDispatchedMessages allows the caller to capture internally dispatched messages.
func GenesisWith ¶
func GenesisWith(time time.Time, values *core.GlobalValues) Option
func GenesisWithVersion ¶ added in v1.1.0
func GenesisWithVersion(time time.Time, version protocol.ExecutorVersion) Option
func InitialAcmeSupply ¶ added in v1.2.10
InitialAcmeSupply overrides the default initial ACME supply. A value of nil will disable setting the initial supply.
func LocalNetwork ¶ added in v1.1.0
func SimpleNetwork ¶
func SnapshotFromDirectory ¶
func SnapshotMap ¶ added in v1.1.0
func WithDatabase ¶ added in v1.1.1
func WithDatabase(fn OpenDatabaseFunc) Option
func WithLogger ¶ added in v1.2.10
func WithNetwork ¶ added in v1.1.1
func WithNetwork(net *accumulated.NetworkInit) Option
func WithRecordings ¶ added in v1.2.10
func WithRecordings(fn RecordingFunc) Option
WithRecordings takes a function that returns files to write node recordings to.
func WithSnapshot ¶ added in v1.1.1
func WithSnapshot(fn SnapshotFunc) Option
type Partition ¶
type Partition struct { protocol.PartitionInfo // contains filtered or unexported fields }
func (*Partition) Begin ¶ added in v1.1.0
Begin will panic if called to create a writable batch if the partition has more than one node.
func (*Partition) SetBlockHook ¶ added in v1.1.0
func (p *Partition) SetBlockHook(fn BlockHookFunc)
SetBlockHook sets a general block hook. SetBlockHook is mutually exclusive with SetNodeBlockHook.
func (*Partition) SetNodeBlockHook ¶ added in v1.1.1
func (p *Partition) SetNodeBlockHook(fn NodeBlockHookFunc)
SetNodeBlockHook sets a node-specific block hook. SetNodeBlockHook is mutually exclusive with SetBlockHook.
func (*Partition) SetObserver ¶ added in v1.1.0
func (*Partition) SetSubmitHook ¶
func (p *Partition) SetSubmitHook(fn SubmitHookFunc)
type RecordingFunc ¶ added in v1.2.0
type RecordingFunc = func(partition string, node int) (io.WriteSeeker, error)
type ResponseSubmit ¶ added in v1.1.1
type ResponseSubmit struct { Code uint32 Data []byte Log string Info string Codespace string MempoolError string }
ResponseSubmit is the response from a call to Submit.
type Simulator ¶
type Simulator struct {
// contains filtered or unexported fields
}
func (*Simulator) BlockIndex ¶ added in v1.1.0
func (*Simulator) BlockIndexFor ¶ added in v1.1.0
func (*Simulator) ClientV2 ¶ added in v1.1.0
ClientV2 returns an API V2 client for the given partition.
func (*Simulator) Collect ¶ added in v1.1.1
func (s *Simulator) Collect(partition string, file io.WriteSeeker, opts *database.CollectOptions) error
func (*Simulator) ListenAndServe ¶
func (s *Simulator) ListenAndServe(ctx context.Context, opts ListenOptions) (err error)
ListenAndServe serves the Accumulate API. The simulator must have been initialized with a network configuration that includes addresses. At least one of the Listen options of opts must be true.
func (*Simulator) NewDirectClientWithHook ¶ added in v1.1.0
NewDirectClientWithHook creates a direct HTTP client and applies the given hook.
func (*Simulator) Partitions ¶
func (s *Simulator) Partitions() []*protocol.PartitionInfo
func (*Simulator) Services ¶ added in v1.1.0
Services returns the simulator's API v3 implementation.
func (*Simulator) SetBlockHook ¶ added in v1.1.0
func (s *Simulator) SetBlockHook(partition string, fn BlockHookFunc)
func (*Simulator) SetBlockHookFor ¶ added in v1.1.0
func (s *Simulator) SetBlockHookFor(account *url.URL, fn BlockHookFunc)
func (*Simulator) SetNodeBlockHook ¶ added in v1.1.1
func (s *Simulator) SetNodeBlockHook(partition string, fn NodeBlockHookFunc)
func (*Simulator) SetNodeBlockHookFor ¶ added in v1.1.1
func (s *Simulator) SetNodeBlockHookFor(account *url.URL, fn NodeBlockHookFunc)
func (*Simulator) SetSubmitHook ¶
func (s *Simulator) SetSubmitHook(partition string, fn SubmitHookFunc)
func (*Simulator) SetSubmitHookFor ¶ added in v1.1.0
func (s *Simulator) SetSubmitHookFor(account *url.URL, fn SubmitHookFunc)
func (*Simulator) SignWithNode ¶
type SnapshotFunc ¶
type SnapshotFunc = func(partition string, network *accumulated.NetworkInit, logger log.Logger) (ioutil2.SectionReader, error)