mock

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Canister

type Canister struct {
	Id      principal.Principal
	Methods map[string]Method
}

type HandlerFunc

type HandlerFunc func(request Request) ([]any, error)

type Method

type Method struct {
	Name      string      // Name is the name of the method.
	Arguments []any       // Arguments is a list of pointers to the arguments, that will be filled by the agent.
	Handler   HandlerFunc // Handler is the function that will be called when the method is called.
}

type Replica

type Replica struct {
	Canisters map[string]Canister
	Requests  map[string]agent.Request
	// contains filtered or unexported fields
}

func NewReplica

func NewReplica() *Replica

func (*Replica) AddCanister

func (r *Replica) AddCanister(
	id principal.Principal,
	methods []Method,
)

AddCanister adds a canister to the replica.

func (*Replica) ServeHTTP

func (r *Replica) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type Request

type Request struct {
	Type      agent.RequestType
	Sender    principal.Principal
	Arguments []any
}

Jump to

Keyboard shortcuts

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