Documentation ¶
Index ¶
- func BindMethod(ctx context.Context, in *syscall.BindMethodRequest) (*syscall.BindMethodResponse, syscall.KernelErr)
- func BindMethod_(int32, int32, int32, int32) int64
- func ClientSide[T proto.Message, U proto.Message](ctx context.Context, t T, u U, fn func(int32, int32, int32, int32) int64) (outU U, outId int32, signal bool)
- func CompleteCall(ctx context.Context, hid id.HostId, cid id.CallId, result *anypb.Any, ...) syscall.KernelErr
- func CurrentHostId() id.HostId
- func CurrentTimezone() *time.Location
- func Dispatch(ctx context.Context, inPtr *syscall.DispatchRequest) (*syscall.DispatchResponse, syscall.KernelErr)
- func Dispatch_(int32, int32, int32, int32) int64
- func Exit_(int32, int32, int32, int32) int64
- func ExpireMethod(ctx context.Context, curr time.Time)
- func Export(ctx context.Context, inPtr *syscall.ExportRequest) (*syscall.ExportResponse, syscall.KernelErr)
- func Export_(int32, int32, int32, int32) int64
- func Launch_(int32, int32, int32, int32) int64
- func Locate(ctx context.Context, inPtr *syscall.LocateRequest) (*syscall.LocateResponse, syscall.KernelErr)
- func Locate_(int32, int32, int32, int32) int64
- func MatchCompleter(ctx context.Context, t time.Time, hid id.HostId, origHost id.HostId, ...)
- func MustBindMethodName(ctx context.Context, in *syscall.BindMethodRequest) id.MethodId
- func NewExitCompleter(f *ExitFuture) future.Completer
- func NewLaunchCompleter(f *LaunchFuture) future.Completer
- func ReadOne(ctx context.Context, in *syscall.ReadOneRequest) (*syscall.ReadOneResponse, syscall.KernelErr)
- func ReadOne_(int32, int32, int32, int32) int64
- func Register(ctx context.Context, inPtr *syscall.RegisterRequest) (*syscall.RegisterResponse, syscall.KernelErr)
- func Register_(int32, int32, int32, int32) int64
- func Require(ctx context.Context, inPtr *syscall.RequireRequest) (*syscall.RequireResponse, syscall.KernelErr)
- func Require_(int32, int32, int32, int32) int64
- func ReturnValue(ctx context.Context, in *syscall.ReturnValueRequest) syscall.KernelErr
- func ReturnValue_(int32, int32, int32, int32) int64
- type ExitCompleter
- func (l *ExitCompleter) Cancel()
- func (l *ExitCompleter) CompleteMethod(ctx context.Context, a proto.Message, e int32, orig id.HostId) syscall.KernelErr
- func (l *ExitCompleter) Completed() bool
- func (l *ExitCompleter) Failure(failFunc func(int32))
- func (l *ExitCompleter) Success(succFunc func(proto.Message))
- type ExitFuture
- type LaunchCompleter
- func (l *LaunchCompleter) Cancel()
- func (l *LaunchCompleter) CompleteMethod(ctx context.Context, a proto.Message, e int32, orig id.HostId) syscall.KernelErr
- func (l *LaunchCompleter) Completed() bool
- func (l *LaunchCompleter) Failure(failFunc func(int32))
- func (l *LaunchCompleter) Success(succFunc func(proto.Message))
- type LaunchFuture
- func (l *LaunchFuture) Cancel()
- func (l *LaunchFuture) CompleteMethod(ctx context.Context, lr *syscall.LaunchResponse, err syscall.KernelErr)
- func (l *LaunchFuture) Completed() bool
- func (l *LaunchFuture) Failure(fn func(syscall.KernelErr))
- func (l *LaunchFuture) Success(fn func(*syscall.LaunchResponse))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindMethod ¶
func BindMethod_ ¶
BindMethod is the way that a particular service gets associated with a given method id. This is normally not needed by user code because the generated code for any service will call this automatically.
func BindMethod(*syscall.BindMethodRequest) *syscall.BindMethodResponse
func ClientSide ¶
func ClientSide[T proto.Message, U proto.Message](ctx context.Context, t T, u U, fn func(int32, int32, int32, int32) int64) (outU U, outId int32, signal bool)
ClientSide does the marshalling and unmarshalling needed to read the T given, write the U given, and return the KernelErrId properly. It does these manipulations so you can call a lower level function that is implemented by the host. The final bool is a meta indicator about if we detected a crash and the client side of the program should exit.
func CompleteCall ¶
func CompleteCall(ctx context.Context, hid id.HostId, cid id.CallId, result *anypb.Any, resultErr int32) syscall.KernelErr
CompleteCall is called from the ReadOneAndCall handler to cause a prior dispatch call to be completed. The matching is done based on the cid.
func CurrentHostId ¶
CurrentHostId provides the interface to the runner's chosen host id for our WASM machine. That value is communicated through environment variables.
func CurrentTimezone ¶
CurrentTimezone provides the interface to the configuration file's timezone string for our WASM machine. That value is communicated through environment variables.
func Dispatch_ ¶
Dispatch is the primary means that a caller can send an RPC message. If you are in local development mode, this call is handled by the kernel itself, otherwise it implies a remote procedure call. This method checks the returned response for errors. If there are errors inside the result they are pulled out and returned in the error parameter. Thus if the error parameter is nil, the Dispatch() occurred successfully. This is code that runs on the WASM side.
func Exit_ ¶
Exit is called from the WASM side to cause the WASM program, or all the WASM programs, to exit. It does not return.
func ExpireMethod ¶
ExpireMethod() checks the internal list of guest side futures that have no call id associated with them. These futures come about when a implementation of a server function returns a future that is not completed. This future likely exists because the implementation of the server function called another service and the result of the server function thus cannot be calculated immediately. When the call is completed, the Success or Failure functions will be called on the original future. This function exists to maintain a list so that we can expire and cancel futures that have waiting longer than the timeout time.
func Export_ ¶
Export is a declaration that a service implements a particular interface. This is not needed by most user code that will use queue.ExportQueueServiceOrPanic() to export itself as the queue service.
func Launch_ ¶
Run is starts a service (or a guest application) running. Note that this may not return immediately and may fail entirely. For most user code this is not used because user code usually uses file.MustFileServiceRun() to block service File until it is cleared to run.
func Locate_ ¶
Locate is the means of aquiring a handle to a particular service. Most users will not want this interface, but rather will use the auto generated method LocateFooOrPanic() for getting an initial handle the Foo service.
func Locate(*syscall.LocateRequest) *syscall.LocateResponse
func MatchCompleter ¶
func MatchCompleter(ctx context.Context, t time.Time, hid id.HostId, origHost id.HostId, cid id.CallId, comp future.Completer)
MatchCompleter is a utility for adding a new cid and completer to the tables used to look up the location where response values should be sent. The time value has be passed in from the outside.
func MustBindMethodName ¶
func NewExitCompleter ¶
func NewExitCompleter(f *ExitFuture) future.Completer
func NewLaunchCompleter ¶
func NewLaunchCompleter(f *LaunchFuture) future.Completer
func ReadOne_ ¶
ReadOne checks to see if any of the service/method pairs have been called. Timeouts of negative values (forever) and 0 (instant check) are legal.
func Register_ ¶
Register should be called before any other services are Required, Exported, or Located.
func Require_ ¶
Require is a declaration that a service needs a particular interface. This is not needed by most user code that will use queue.ImpleQueueServiceOrPanic() to import the queue service.
func ReturnValue ¶
Types ¶
type ExitCompleter ¶
type ExitCompleter struct {
// contains filtered or unexported fields
}
func (*ExitCompleter) Cancel ¶
func (l *ExitCompleter) Cancel()
func (*ExitCompleter) CompleteMethod ¶
func (*ExitCompleter) Completed ¶
func (l *ExitCompleter) Completed() bool
func (*ExitCompleter) Failure ¶
func (l *ExitCompleter) Failure(failFunc func(int32))
func (*ExitCompleter) Success ¶
func (l *ExitCompleter) Success(succFunc func(proto.Message))
type ExitFuture ¶
type ExitFuture struct {
// contains filtered or unexported fields
}
ExitFuture is the return type of Exit() on the guest side. This is a future because it is not certain exactly when the Exit will actually occur. Further, the exit itself might fail, so the program may not exit at all.
func Exit ¶
func Exit(ctx context.Context, inPtr *syscall.ExitRequest) *ExitFuture
func NewExitFuture ¶
func NewExitFuture() *ExitFuture
NewExitFuture returns an initialized exit future. It is not useful to attempt to determine if the exit has "completed" as the program would no longer exit.
func (*ExitFuture) Cancel ¶
func (l *ExitFuture) Cancel()
func (*ExitFuture) CompleteMethod ¶
func (l *ExitFuture) CompleteMethod(ctx context.Context, lr *syscall.ExitResponse, err syscall.KernelErr)
CompleteMethod is used to complete a previously defined future of type ExitFuture.
func (*ExitFuture) Completed ¶
func (l *ExitFuture) Completed() bool
func (*ExitFuture) Failure ¶
func (l *ExitFuture) Failure(fn func(syscall.KernelErr))
Failure should be called to add a function to be called when the Exit() has fully completed and was unsuccessful. Note that this situation is a serious internal error in parigot when the given method fn is called. It is appropriate to take drastic measures like `os.Exit(1)` to force the abort of the program.
func (*ExitFuture) Success ¶
func (l *ExitFuture) Success(fn func(*syscall.ExitResponse))
Success should be called to add a function to be called when the Exit() has fully completed and did so successfully. Adding an exit function here can useful to clean up resources, with the understanding that the program is _about_ to exit. The function fn should NOT exit the program with a call like os.Exit(1), this will happen once all the Success functions on the ExitFuture have been called.
type LaunchCompleter ¶
type LaunchCompleter struct {
// contains filtered or unexported fields
}
func (*LaunchCompleter) Cancel ¶
func (l *LaunchCompleter) Cancel()
func (*LaunchCompleter) CompleteMethod ¶
func (*LaunchCompleter) Completed ¶
func (l *LaunchCompleter) Completed() bool
func (*LaunchCompleter) Failure ¶
func (l *LaunchCompleter) Failure(failFunc func(int32))
func (*LaunchCompleter) Success ¶
func (l *LaunchCompleter) Success(succFunc func(proto.Message))
type LaunchFuture ¶
type LaunchFuture struct {
// contains filtered or unexported fields
}
LaunchFuture is the return type of Launch() on the guest side. The guest receives the future in response to a Launch() call and should attach Success() and Failure() funcs as needed. If the Completed() call is true, the methods added in Success() or Failure() will be called immediately.
func Launch ¶
func Launch(ctx context.Context, inPtr *syscall.LaunchRequest) *LaunchFuture
func NewLaunchFuture ¶
func NewLaunchFuture() *LaunchFuture
func (*LaunchFuture) Cancel ¶
func (l *LaunchFuture) Cancel()
func (*LaunchFuture) CompleteMethod ¶
func (l *LaunchFuture) CompleteMethod(ctx context.Context, lr *syscall.LaunchResponse, err syscall.KernelErr)
CompleteMethod fills in the results for a Method future and it works the same for LaunchResponse.
func (*LaunchFuture) Completed ¶
func (l *LaunchFuture) Completed() bool
Completed returns if the given LaunchFuture has already been completed. This might be interesting for some guests if they wish to bypass the futures mechanism in the case where the Launch() has already finished. Note that quick completion of Launch() is NOT guaranteed in all cases so clients that use this method to bypass futures must also have a backup approach for when the Launch() takes some time to complete.
func (*LaunchFuture) Failure ¶
func (l *LaunchFuture) Failure(fn func(syscall.KernelErr))
Failure should be called to add a function to be called when the Launch() has fully completed and was unsuccessful.
func (*LaunchFuture) Success ¶
func (l *LaunchFuture) Success(fn func(*syscall.LaunchResponse))
Success should be called to add a function to be called when the Launch() has fully completed and did so successfully.