kernel

package
v1.49.0-go-generics.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package kernel defines the interface for go programs to interact with the @jsii/kernel node process. This module completely abstracts managament of the child process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseClient

func CloseClient()

CloseClient finalizes the runtime process, signalling the end of the execution to the jsii kernel process, and waiting for graceful termination.

If a jsii Client is used *after* CloseClient was called, a new jsii kernel process will be initialized, and CloseClient should be called again to correctly finalize that, too.

func RegisterBoxType

func RegisterBoxType[Box any, Raw any]()

RegisterBoxType is used to register a box type (i.e: jsii.String) with the raw type it converts into (i.e: string).

Types

type BeginProps

type BeginProps struct {
	Method    *string       `json:"method"`
	Arguments []interface{} `json:"args"`
	ObjRef    api.ObjectRef `json:"objref"`
}

type BeginResponse

type BeginResponse struct {
	PromiseID *string `json:"promise_id"`
	// contains filtered or unexported fields
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

The Client struct owns the jsii child process and its io interfaces. It also owns a map (objects) that tracks all object references by ID. This is used to call methods and access properties on objects passed by the runtime process by reference.

func GetClient

func GetClient() *Client

GetClient returns a singleton Client instance, initializing one the first time it is called.

func (*Client) Begin

func (c *Client) Begin(props BeginProps) (response BeginResponse, err error)

func (*Client) CastAndSetToPtr

func (c *Client) CastAndSetToPtr(ptr interface{}, data interface{})

CastAndSetToPtr accepts a pointer to any type and attempts to cast the value argument to be the same type. Then it sets the value of the pointer element to be the newly cast data. This is used to cast payloads from JSII to expected return types for Get and Invoke functions.

func (*Client) CastPtrToRef

func (c *Client) CastPtrToRef(dataVal reflect.Value) interface{}

Accepts pointers to structs that implement interfaces and searches for an existing object reference in the kernel. If it exists, it casts it to an objref for the runtime. Recursively casts types that may contain nested object references.

func (*Client) Complete

func (c *Client) Complete(props CompleteProps) (response CompleteResponse, err error)

func (*Client) Create

func (c *Client) Create(props CreateProps) (response CreateResponse, err error)

func (*Client) Del

func (c *Client) Del(props DelProps) (response DelResponse, err error)

func (*Client) End

func (c *Client) End(props EndProps) (response EndResponse, err error)

func (*Client) FindObjectRef

func (c *Client) FindObjectRef(obj reflect.Value) (string, bool)

func (*Client) Get

func (c *Client) Get(props GetProps) (response GetResponse, err error)

func (*Client) GetObject

func (c *Client) GetObject(objref api.ObjectRef) interface{}

func (*Client) Invoke

func (c *Client) Invoke(props InvokeProps) (response InvokeResponse, err error)

func (*Client) Load

func (c *Client) Load(props LoadProps, tarball []byte) (response LoadResponse, err error)

Load ensures the specified assembly has been loaded into the @jsii/kernel process. This call is idempotent (calling it several times with the same input results in the same output).

func (*Client) ManageObject

func (c *Client) ManageObject(v reflect.Value) (ref api.ObjectRef, err error)

func (*Client) Naming

func (c *Client) Naming(props NamingProps) (response NamingResponse, err error)

func (*Client) RegisterAlias

func (c *Client) RegisterAlias(value reflect.Value, objId string) error

RegisterAlias registers the provided object instance as an alias for the provided original object. Returns an error if the object was already registered to an object ID.

func (*Client) RegisterInstance

func (c *Client) RegisterInstance(instance reflect.Value, instanceID string) error

func (*Client) SGet

func (c *Client) SGet(props StaticGetProps) (response GetResponse, err error)

func (*Client) SInvoke

func (c *Client) SInvoke(props StaticInvokeProps) (response InvokeResponse, err error)

func (*Client) SSet

func (c *Client) SSet(props StaticSetProps) (response SetResponse, err error)

func (*Client) Set

func (c *Client) Set(props SetProps) (response SetResponse, err error)

func (*Client) Stats

func (c *Client) Stats() (response StatsResponse, err error)

func (*Client) Types

func (c *Client) Types() *typeregistry.TypeRegistry

type CompleteProps

type CompleteProps struct {
	CallbackID *string     `json:"cbid"`
	Error      *string     `json:"err"`
	Result     interface{} `json:"result"`
}

type CompleteResponse

type CompleteResponse struct {
	CallbackID *string `json:"cbid"`
	// contains filtered or unexported fields
}

type CreateProps

type CreateProps struct {
	FQN        api.FQN        `json:"fqn"`
	Interfaces []api.FQN      `json:"interfaces,omitempty"`
	Arguments  []interface{}  `json:"args,omitempty"`
	Overrides  []api.Override `json:"overrides,omitempty"`
}

type CreateResponse

type CreateResponse struct {
	InstanceID string `json:"$jsii.byref"`
	// contains filtered or unexported fields
}

TODO extends AnnotatedObjRef?

func (*CreateResponse) UnmarshalJSON

func (r *CreateResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON provides custom unmarshalling implementation for response structs. Creating new types is required in order to avoid infinite recursion.

type DelProps

type DelProps struct {
	ObjRef api.ObjectRef `json:"objref"`
}

type DelResponse

type DelResponse struct {
	// contains filtered or unexported fields
}

type EndProps

type EndProps struct {
	PromiseID *string `json:"promise_id"`
}

type EndResponse

type EndResponse struct {
	Result interface{} `json:"result"`
	// contains filtered or unexported fields
}

type GetProps

type GetProps struct {
	Property string        `json:"property"`
	ObjRef   api.ObjectRef `json:"objref"`
}

type GetResponse

type GetResponse struct {
	Value interface{} `json:"value"`
	// contains filtered or unexported fields
}

func (*GetResponse) UnmarshalJSON

func (r *GetResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON provides custom unmarshalling implementation for response structs. Creating new types is required in order to avoid infinite recursion.

type InvokeProps

type InvokeProps struct {
	Method    string        `json:"method"`
	Arguments []interface{} `json:"args"`
	ObjRef    api.ObjectRef `json:"objref"`
}

type InvokeResponse

type InvokeResponse struct {
	Result interface{} `json:"result"`
	// contains filtered or unexported fields
}

func (*InvokeResponse) UnmarshalJSON

func (r *InvokeResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON provides custom unmarshalling implementation for response structs. Creating new types is required in order to avoid infinite recursion.

type LoadProps

type LoadProps struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

LoadProps holds the necessary information to load a library into the @jsii/kernel process through the Load method.

type LoadResponse

type LoadResponse struct {
	Assembly string  `json:"assembly"`
	Types    float64 `json:"types"`
	// contains filtered or unexported fields
}

LoadResponse contains the data returned by the @jsii/kernel process in response to a load request.

func (*LoadResponse) UnmarshalJSON

func (r *LoadResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON provides custom unmarshalling implementation for response structs. Creating new types is required in order to avoid infinite recursion.

type NamingProps

type NamingProps struct {
	Assembly string `json:"assembly"`
}

type NamingResponse

type NamingResponse struct {
	// contains filtered or unexported fields
}

type SetProps

type SetProps struct {
	Property string        `json:"property"`
	Value    interface{}   `json:"value"`
	ObjRef   api.ObjectRef `json:"objref"`
}

type SetResponse

type SetResponse struct {
	// contains filtered or unexported fields
}

func (*SetResponse) UnmarshalJSON

func (r *SetResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON provides custom unmarshalling implementation for response structs. Creating new types is required in order to avoid infinite recursion.

type StaticGetProps

type StaticGetProps struct {
	FQN      api.FQN `json:"fqn"`
	Property string  `json:"property"`
}

type StaticInvokeProps

type StaticInvokeProps struct {
	FQN       api.FQN       `json:"fqn"`
	Method    string        `json:"method"`
	Arguments []interface{} `json:"args"`
}

type StaticSetProps

type StaticSetProps struct {
	FQN      api.FQN     `json:"fqn"`
	Property string      `json:"property"`
	Value    interface{} `json:"value"`
}

type StatsResponse

type StatsResponse struct {
	ObjectCount float64 `json:"object_count"`
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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