Documentation
¶
Overview ¶
Package gcplro is an in-memory google.longrunning.Operations server for the GCP emulators. Operations are recorded already finished, so Wait and Cancel never block or change state.
Index ¶
- func Done(name string, meta, resp proto.Message) (*longrunningpb.Operation, error)
- type Store
- func (s *Store) CancelOperation(_ context.Context, in *longrunningpb.CancelOperationRequest) (*emptypb.Empty, error)
- func (s *Store) DeleteOperation(_ context.Context, in *longrunningpb.DeleteOperationRequest) (*emptypb.Empty, error)
- func (s *Store) GetOperation(_ context.Context, in *longrunningpb.GetOperationRequest) (*longrunningpb.Operation, error)
- func (s *Store) ListOperations(_ context.Context, in *longrunningpb.ListOperationsRequest) (*longrunningpb.ListOperationsResponse, error)
- func (s *Store) Lookup(name string) (*longrunningpb.Operation, bool)
- func (s *Store) Put(op *longrunningpb.Operation) *longrunningpb.Operation
- func (s *Store) Reset()
- func (s *Store) Restore(snap map[string]json.RawMessage) error
- func (s *Store) Snapshot() map[string]json.RawMessage
- func (s *Store) WaitOperation(_ context.Context, in *longrunningpb.WaitOperationRequest) (*longrunningpb.Operation, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Store ¶
type Store struct {
longrunningpb.UnimplementedOperationsServer
// contains filtered or unexported fields
}
Store holds operations by full name and serves them over the Operations gRPC API.
func (*Store) CancelOperation ¶
func (s *Store) CancelOperation(_ context.Context, in *longrunningpb.CancelOperationRequest) (*emptypb.Empty, error)
CancelOperation succeeds without effect: a finished operation cannot be cancelled.
func (*Store) DeleteOperation ¶
func (s *Store) DeleteOperation(_ context.Context, in *longrunningpb.DeleteOperationRequest) (*emptypb.Empty, error)
DeleteOperation removes the named operation.
func (*Store) GetOperation ¶
func (s *Store) GetOperation( _ context.Context, in *longrunningpb.GetOperationRequest, ) (*longrunningpb.Operation, error)
GetOperation returns the named operation.
func (*Store) ListOperations ¶
func (s *Store) ListOperations( _ context.Context, in *longrunningpb.ListOperationsRequest, ) (*longrunningpb.ListOperationsResponse, error)
ListOperations lists the operations directly under in.Name ("<parent>/operations/<id>"), ordered by name.
func (*Store) Lookup ¶
func (s *Store) Lookup(name string) (*longrunningpb.Operation, bool)
Lookup returns a copy of the named operation.
func (*Store) Put ¶
func (s *Store) Put(op *longrunningpb.Operation) *longrunningpb.Operation
Put records op and returns a copy of it.
func (*Store) Restore ¶
func (s *Store) Restore(snap map[string]json.RawMessage) error
Restore replaces the stored operations with a Snapshot result.
func (*Store) Snapshot ¶
func (s *Store) Snapshot() map[string]json.RawMessage
Snapshot serialises every operation as protojson.
func (*Store) WaitOperation ¶
func (s *Store) WaitOperation( _ context.Context, in *longrunningpb.WaitOperationRequest, ) (*longrunningpb.Operation, error)
WaitOperation returns the named operation at once because every operation is already finished.