Documentation
¶
Index ¶
- Variables
- type APINode
- func (n *APINode) ExecuteFunction(ctx context.Context, req execute.Request, subgroup string) (codes.Code, string, execute.ResultMap, execute.Cluster, error)
- func (n *APINode) ExecutionResult(id string) (execute.ResultMap, bool)
- func (n *APINode) PublishFunctionInstall(ctx context.Context, uri string, cid string, subgroup string) error
- type Codec
- type Executor
- type FStore
- type NodeCore
- func (c NodeCore) Connected(peerID peer.ID) bool
- func (c NodeCore) Host() *host.Host
- func (c NodeCore) ID() string
- func (c NodeCore) JoinTopic(topic string) error
- func (c NodeCore) Log() *zerolog.Logger
- func (c NodeCore) Metrics() *metrics.Metrics
- func (c NodeCore) Publish(ctx context.Context, msg bls.Message) error
- func (c NodeCore) PublishToTopic(ctx context.Context, topic string, msg bls.Message) error
- func (c NodeCore) Run(context.Context, func(context.Context, peer.ID, string, []byte) error) error
- func (c NodeCore) Send(ctx context.Context, peerID peer.ID, msg bls.Message) error
- func (c NodeCore) SendToMany(ctx context.Context, peerIDs []peer.ID, msg bls.Message, flag bool) error
- func (c NodeCore) Subscribe(ctx context.Context, topic string) error
- func (c NodeCore) Tracer() *tracing.Tracer
- type Store
- func (s *Store) RemoveFunction(ctx context.Context, id string) error
- func (s *Store) RemovePeer(ctx context.Context, id peer.ID) error
- func (s *Store) RetrieveFunction(ctx context.Context, cid string) (bls.FunctionRecord, error)
- func (s *Store) RetrieveFunctions(ctx context.Context) ([]bls.FunctionRecord, error)
- func (s *Store) RetrievePeer(ctx context.Context, id peer.ID) (bls.Peer, error)
- func (s *Store) RetrievePeers(ctx context.Context) ([]bls.Peer, error)
- func (s *Store) SaveFunction(ctx context.Context, function bls.FunctionRecord) error
- func (s *Store) SavePeer(ctx context.Context, peer bls.Peer) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NoopLogger = zerolog.New(io.Discard) GenericError = errors.New("dummy error") GenericPeerID = peer.ID([]byte{0x0, 0x24, 0x8, 0x1, 0x12, 0x20, 0x56, 0x77, 0x86, 0x82, 0x76, 0xa, 0xc5, 0x9, 0x63, 0xde, 0xe4, 0x31, 0xfc, 0x44, 0x75, 0xdd, 0x5a, 0x27, 0xee, 0x6b, 0x94, 0x13, 0xed, 0xe2, 0xa3, 0x6d, 0x8a, 0x1d, 0x57, 0xb6, 0xb8, 0x91}) GenericAddress = "/ip4/127.0.0.1/tcp/9000/p2p/12D3KooWRp3AVk7qtc2Av6xiqgAza1ZouksQaYcS2cvN94kHSCoa" GenericMultiaddress = multiaddr.StringCast(GenericAddress) GenericString = "test" GenericUUID = uuid.UUID{0xd1, 0xc2, 0x44, 0xaf, 0xa3, 0x1d, 0x48, 0x87, 0x93, 0x9d, 0xd6, 0xc7, 0xf, 0xe, 0x4f, 0xd0} GenericExecutionResult = execute.Result{ Code: codes.Unknown, Result: execute.RuntimeOutput{ Stdout: "generic-execution-result", Stderr: "generic-execution-log", ExitCode: 0, }, } GenericExecutionResultMap = execute.ResultMap{ GenericPeerID: { Result: GenericExecutionResult, }, } GenericExecutionRequest = execute.Request{ FunctionID: "generic-function-id", Method: "wasm", Parameters: []execute.Parameter{ { Name: "generic-param-name", Value: "generic-param-value", }, }, } GenericManifest = bls.FunctionManifest{ ID: "generic-id", Name: "generic-name", Description: "generic-description", Function: bls.Function{ ID: "function-id", Name: "function-name", Runtime: "generic-runtime", }, Deployment: bls.Deployment{ CID: "generic-cid", Checksum: "1234567890", URI: "generic-uri", }, FSRootPath: "/var/tmp/bless/", Entry: "/var/tmp/bless/app.wasm", } // List of a few peer IDs in case multiple are required. GenericPeerIDs = []peer.ID{ peer.ID([]byte{0x0, 0x24, 0x8, 0x1, 0x12, 0x20, 0xe5, 0xc, 0xbd, 0xb8, 0xff, 0xed, 0x5a, 0x74, 0x48, 0x4, 0x2, 0x33, 0x4e, 0x42, 0xc, 0x40, 0xab, 0x28, 0x3a, 0x28, 0xdb, 0x5, 0x7e, 0xc6, 0xf5, 0x0, 0x6f, 0x36, 0xa2, 0x8d, 0x82, 0x48}), peer.ID([]byte{0x0, 0x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, 0x31, 0x5c, 0x55, 0xf, 0xbd, 0xae, 0x77, 0x95}), peer.ID([]byte{0x0, 0x24, 0x8, 0x1, 0x12, 0x20, 0x9, 0xb1, 0x4c, 0x68, 0xd5, 0x17, 0x29, 0x76, 0xbc, 0xca, 0xe8, 0xa8, 0x76, 0x7c, 0x2b, 0x82, 0x68, 0xa1, 0xae, 0xe8, 0x35, 0x4b, 0x42, 0xff, 0x5f, 0xaa, 0xe9, 0x6, 0x2d, 0x46, 0xa1, 0x9c}), peer.ID([]byte{0x0, 0x24, 0x8, 0x1, 0x12, 0x20, 0xc3, 0x36, 0xd9, 0xea, 0x3, 0x29, 0x85, 0x17, 0x8e, 0x60, 0xa, 0xc5, 0xf, 0x5d, 0xe3, 0xe8, 0xd, 0x1c, 0x53, 0x7b, 0x31, 0x82, 0x58, 0xc9, 0x4e, 0x80, 0x97, 0x8d, 0x6d, 0x1c, 0x97, 0x86}), peer.ID([]byte{0x0, 0x24, 0x8, 0x1, 0x12, 0x20, 0x49, 0xbd, 0x82, 0x34, 0x7d, 0x97, 0xd, 0xb5, 0x52, 0xf5, 0x82, 0x47, 0x8b, 0xc, 0x42, 0x16, 0x22, 0xa5, 0x24, 0x32, 0xf2, 0x24, 0xfb, 0xc7, 0x44, 0xd1, 0xfc, 0xe1, 0x2e, 0xd3, 0x70, 0xa7}), peer.ID([]byte{0x0, 0x24, 0x8, 0x1, 0x12, 0x20, 0x24, 0x49, 0x1b, 0x67, 0x6, 0x91, 0x6, 0x94, 0xa, 0xcb, 0x5d, 0x1c, 0xe5, 0x69, 0x37, 0xbe, 0x7c, 0x6b, 0x7e, 0x97, 0x4b, 0x44, 0xd7, 0xbe, 0x94, 0x22, 0x9f, 0xfa, 0x1e, 0x7e, 0x2d, 0xcf}), peer.ID([]byte{0x0, 0x24, 0x8, 0x1, 0x12, 0x20, 0x15, 0xf8, 0xc7, 0x4b, 0x28, 0x5e, 0x1e, 0xf9, 0x96, 0xd8, 0xbd, 0x15, 0xf9, 0xde, 0x46, 0x39, 0x30, 0xe1, 0xa1, 0x2e, 0xa4, 0x17, 0x5f, 0xef, 0xbd, 0x2d, 0xe4, 0xd1, 0x43, 0xe8, 0xcb, 0x53}), peer.ID([]byte{0x0, 0x24, 0x8, 0x1, 0x12, 0x20, 0xd0, 0xca, 0xd3, 0x5c, 0x95, 0xf5, 0xdd, 0xb7, 0x73, 0x4e, 0xe3, 0x6a, 0x6b, 0xfc, 0x73, 0xe5, 0x55, 0x8d, 0xbf, 0x78, 0x2f, 0xa8, 0x42, 0xc9, 0x1d, 0x70, 0xd6, 0xce, 0x2b, 0x9e, 0x4f, 0xf7}), peer.ID([]byte{0x0, 0x24, 0x8, 0x1, 0x12, 0x20, 0x9a, 0xc4, 0x96, 0xd, 0x16, 0x58, 0x7d, 0x93, 0x40, 0xa, 0x7a, 0xf, 0xdf, 0x48, 0x12, 0x19, 0x46, 0xc5, 0x4d, 0x2d, 0x8e, 0x11, 0x96, 0xb2, 0xf6, 0xb7, 0x4e, 0x51, 0xff, 0xee, 0x0, 0xb5}), peer.ID([]byte{0x0, 0x24, 0x8, 0x1, 0x12, 0x20, 0xaa, 0xed, 0x63, 0x5d, 0xa1, 0xdf, 0x41, 0x2b, 0xe8, 0x9c, 0x49, 0xed, 0xe8, 0x0, 0x5c, 0xa8, 0x64, 0x58, 0x1d, 0x3, 0xf3, 0x59, 0x41, 0x74, 0xff, 0x2b, 0xcd, 0xde, 0x37, 0xfe, 0x15, 0xc6}), peer.ID([]byte{0x0, 0x24, 0x8, 0x1, 0x12, 0x20, 0xc6, 0x8f, 0x95, 0xd3, 0x98, 0x66, 0x40, 0x6b, 0xc4, 0x6c, 0x19, 0x5e, 0x80, 0xe0, 0x8c, 0x9b, 0x15, 0x4f, 0x8c, 0x6b, 0xd0, 0x1d, 0x5b, 0x83, 0x23, 0x7b, 0x9a, 0x97, 0xc0, 0x9b, 0x9d, 0x9b}), } GenericPeer = bls.Peer{ ID: GenericPeerID, MultiAddr: GenericMultiaddress.String(), AddrInfo: peer.AddrInfo{ ID: GenericPeerID, Addrs: []multiaddr.Multiaddr{GenericMultiaddress}, }, } GenericFunctionRecord = bls.FunctionRecord{ CID: "dummy-cid", URL: fmt.Sprintf("https://example.com/%v", GenericString), Manifest: GenericManifest, Archive: "/var/tmp/archive.tar.gz", Files: "/var/tmp/files", } )
Global variables that can be used for testing. They are valid non-nil values for commonly needed types.
Functions ¶
This section is empty.
Types ¶
type APINode ¶
type APINode struct { ExecuteFunctionFunc func(context.Context, execute.Request, string) (codes.Code, string, execute.ResultMap, execute.Cluster, error) ExecutionResultFunc func(id string) (execute.ResultMap, bool) PublishFunctionInstallFunc func(ctx context.Context, uri string, cid string, subgroup string) error }
APINode implements the `Node` interface expected by the API.
func BaselineNode ¶
func (*APINode) ExecuteFunction ¶
func (*APINode) ExecutionResult ¶
type Codec ¶
func BaselineCodec ¶
type Executor ¶
type Executor struct {
ExecFunctionFunc func(context.Context, string, execute.Request) (execute.Result, error)
}
func BaselineExecutor ¶
type FStore ¶
type FStore struct { InstallFunc func(context.Context, string, string) error IsInstalledFunc func(string) (bool, error) SyncFunc func(context.Context, bool) error }
func BaselineFStore ¶
type NodeCore ¶
type NodeCore struct { IDFunc func() string LogFunc func() *zerolog.Logger HostFunc func() *host.Host ConnectedFunc func(peer.ID) bool SendFunc func(context.Context, peer.ID, bls.Message) error SendToManyFunc func(context.Context, []peer.ID, bls.Message, bool) error JoinTopicFunc func(string) error SubscribeFunc func(context.Context, string) error PublishFunc func(context.Context, bls.Message) error PublishToTopicFunc func(context.Context, string, bls.Message) error TracerFunc func() *tracing.Tracer MetricsFunc func() *metrics.Metrics RunFunc func(context.Context, func(context.Context, peer.ID, string, []byte) error) error }
func BaselineNodeCore ¶
func (NodeCore) PublishToTopic ¶
func (NodeCore) SendToMany ¶
type Store ¶
type Store struct { SavePeerFunc func(context.Context, bls.Peer) error RetrievePeerFunc func(context.Context, peer.ID) (bls.Peer, error) RetrievePeersFunc func(context.Context) ([]bls.Peer, error) RemovePeerFunc func(context.Context, peer.ID) error SaveFunctionFunc func(context.Context, bls.FunctionRecord) error RetrieveFunctionFunc func(context.Context, string) (bls.FunctionRecord, error) RetrieveFunctionsFunc func(context.Context) ([]bls.FunctionRecord, error) RemoveFunctionFunc func(context.Context, string) error }
func BaselineStore ¶
func (*Store) RetrieveFunction ¶
func (*Store) RetrieveFunctions ¶
func (*Store) RetrievePeer ¶
func (*Store) RetrievePeers ¶
func (*Store) SaveFunction ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.