Documentation
¶
Overview ¶
Package actors is the gateway's Substrate client (DBX-32): the actor lifecycle, egress policies, tags and worker drain state, on top of the vendored substrate.ateapi.v1 bindings in pkg/devbox/substrate/ateapi.
pkg/devbox/substrate (the operator's client) covers atespaces and templates; this package covers what only the gateway does. Every call is idempotent: creates return the existing object on AlreadyExists and deletes treat NotFound as success.
Index ¶
- Constants
- Variables
- func EgressRules(p egress.Policy) []*ateapi.EgressRule
- func TagFidelity(t *ateapi.Tag) ateapi.SnapshotFidelity
- type Client
- func (c *Client) ApplyEgressPolicy(ctx context.Context, ref Ref, rules []*ateapi.EgressRule) error
- func (c *Client) Close() error
- func (c *Client) CreateActor(ctx context.Context, spec Spec) (*ateapi.Actor, error)
- func (c *Client) CreateTag(ctx context.Context, tag Ref, source Ref) (*ateapi.Tag, error)
- func (c *Client) DeleteActor(ctx context.Context, ref Ref) error
- func (c *Client) DeleteEgressPolicy(ctx context.Context, ref Ref) error
- func (c *Client) DeleteTag(ctx context.Context, tag Ref) error
- func (c *Client) DrainingWorkers(ctx context.Context) (map[string]bool, error)
- func (c *Client) GetActor(ctx context.Context, ref Ref) (*ateapi.Actor, error)
- func (c *Client) GetTag(ctx context.Context, tag Ref) (*ateapi.Tag, error)
- func (c *Client) ListActors(ctx context.Context, atespace string) ([]*ateapi.Actor, error)
- func (c *Client) Resume(ctx context.Context, ref Ref) error
- func (c *Client) Revert(ctx context.Context, ref Ref) error
- func (c *Client) SetTemplate(ctx context.Context, ref Ref, template string) error
- func (c *Client) Suspend(ctx context.Context, ref Ref, synchronous bool) error
- func (c *Client) WaitState(ctx context.Context, ref Ref, states ...ateapi.ActorState) (*ateapi.Actor, error)
- func (c *Client) WaitTag(ctx context.Context, tag Ref) (*ateapi.Tag, error)
- func (c *Client) WithPollInterval(d time.Duration) *Client
- type Ref
- type Spec
Constants ¶
const (
// EgressPolicyName is the name of an actor's singleton egress policy.
EgressPolicyName = "default"
)
Variables ¶
var ErrCrashed = errors.New("actor crashed")
ErrCrashed is returned by WaitState when the actor crashed while waiting.
Functions ¶
func EgressRules ¶
func EgressRules(p egress.Policy) []*ateapi.EgressRule
EgressRules converts an egress policy to Substrate rules.
func TagFidelity ¶
func TagFidelity(t *ateapi.Tag) ateapi.SnapshotFidelity
TagFidelity reports whether a tag holds memory or only filesystem state.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps substrate.ateapi.v1.Control.
func Dial ¶
Dial connects to ate-api-server like substrate.Dial: TLS with the servicedns CA bundle, plus the projected ServiceAccount token re-read on every call.
func (*Client) ApplyEgressPolicy ¶
ApplyEgressPolicy creates or replaces an actor's egress policy.
func (*Client) CreateActor ¶
CreateActor creates a suspended actor, or returns the existing one.
func (*Client) CreateTag ¶
CreateTag tags a suspended actor's latest snapshot, or returns the existing tag.
func (*Client) DeleteActor ¶
DeleteActor deletes an actor and its egress policy.
func (*Client) DeleteEgressPolicy ¶
func (*Client) DrainingWorkers ¶
DrainingWorkers returns the names of workers being drained: their actors get SIGTERM and must be suspended synchronously within the drain window.
func (*Client) ListActors ¶
ListActors returns every actor in an atespace.
func (*Client) Resume ¶
Resume resumes an actor. It returns once Substrate accepted the request; WaitState waits for RUNNING.
func (*Client) SetTemplate ¶
SetTemplate points a (suspended) actor at another template; its next resume restores volume data and cold-boots (filesystem fidelity).
func (*Client) Suspend ¶
Suspend suspends an actor. Synchronous suspends return once the snapshot is durable (needed before eviction and tagging); asynchronous ones once the actor is suspended locally.
func (*Client) WaitState ¶
func (c *Client) WaitState(ctx context.Context, ref Ref, states ...ateapi.ActorState) (*ateapi.Actor, error)
WaitState polls until the actor reaches one of the states. A crash ends the wait with ErrCrashed unless CRASHED is one of the states.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package actorstest is an in-memory substrate.ateapi.v1.Control server for gateway tests.
|
Package actorstest is an in-memory substrate.ateapi.v1.Control server for gateway tests. |