server

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package server provides a wrapper around state.CoreState into gRPC server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertIDQuery added in v0.3.0

func ConvertIDQuery(input *v1alpha1.IDQuery) ([]resource.IDQueryOption, error)

ConvertIDQuery converts protobuf representation of IDQuery to state representation.

func ConvertLabelQuery

func ConvertLabelQuery(terms []*v1alpha1.LabelTerm) ([]resource.LabelQueryOption, error)

ConvertLabelQuery converts protobuf representation of LabelQuery to state representation.

Types

type State

type State struct {
	v1alpha1.UnimplementedStateServer
	// contains filtered or unexported fields
}

State implements gRPC State service.

func NewState

func NewState(state state.CoreState) *State

NewState initializes new gRPC State service implementation.

func (*State) Create

func (server *State) Create(ctx context.Context, req *v1alpha1.CreateRequest) (*v1alpha1.CreateResponse, error)

Create a resource.

If a resource already exists, Create returns an error.

func (*State) Destroy

func (server *State) Destroy(ctx context.Context, req *v1alpha1.DestroyRequest) (*v1alpha1.DestroyResponse, error)

Destroy a resource.

If a resource doesn't exist, error is returned. If a resource has pending finalizers, error is returned.

func (*State) Get

func (server *State) Get(ctx context.Context, req *v1alpha1.GetRequest) (*v1alpha1.GetResponse, error)

Get a resource by type and ID.

If a resource is not found, error is returned.

func (*State) List

func (server *State) List(req *v1alpha1.ListRequest, srv v1alpha1.State_ListServer) error

List resources by type.

func (*State) Update

func (server *State) Update(ctx context.Context, req *v1alpha1.UpdateRequest) (*v1alpha1.UpdateResponse, error)

Update a resource.

If a resource doesn't exist, error is returned. On update current version of resource `new` in the state should match curVersion, otherwise conflict error is returned.

func (*State) Watch

func (server *State) Watch(req *v1alpha1.WatchRequest, srv v1alpha1.State_WatchServer) error

Watch state of a resource by (namespace, type) or a specific resource by (namespace, type, id).

It's fine to watch for a resource which doesn't exist yet. Watch is canceled when context gets canceled. Watch sends initial resource state as the very first event on the channel, and then sends any updates to the resource as events.

Jump to

Keyboard shortcuts

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