Documentation ¶
Overview ¶
Package server provides a wrapper around state.CoreState into gRPC server.
Index ¶
- func ConvertLabelQuery(terms []*v1alpha1.LabelTerm) ([]resource.LabelQueryOption, error)
- type State
- func (server *State) Create(ctx context.Context, req *v1alpha1.CreateRequest) (*v1alpha1.CreateResponse, error)
- func (server *State) Destroy(ctx context.Context, req *v1alpha1.DestroyRequest) (*v1alpha1.DestroyResponse, error)
- func (server *State) Get(ctx context.Context, req *v1alpha1.GetRequest) (*v1alpha1.GetResponse, error)
- func (server *State) List(req *v1alpha1.ListRequest, srv v1alpha1.State_ListServer) error
- func (server *State) Update(ctx context.Context, req *v1alpha1.UpdateRequest) (*v1alpha1.UpdateResponse, error)
- func (server *State) Watch(req *v1alpha1.WatchRequest, srv v1alpha1.State_WatchServer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 (*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.