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 ¶
- Constants
- func Done(name string, meta, resp proto.Message) (*longrunningpb.Operation, error)
- type Store
- func (s *Store) AbortPending(st *status.Status)
- 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]jsontext.Value) error
- func (s *Store) SetClock(now func() time.Time)
- func (s *Store) SetLimits(maxOps int, maxAge time.Duration)
- func (s *Store) Snapshot() map[string]jsontext.Value
- func (s *Store) Under(prefix string) []*longrunningpb.Operation
- func (s *Store) WaitOperation(_ context.Context, in *longrunningpb.WaitOperationRequest) (*longrunningpb.Operation, error)
Constants ¶
const ( // DefaultMaxOperations bounds the finished operations a Store keeps; the oldest are dropped first. DefaultMaxOperations = 10_000 // DefaultMaxAge is how long a finished operation is kept. DefaultMaxAge = 7 * 24 * time.Hour )
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) AbortPending ¶
AbortPending resolves every unfinished operation with st, for operations whose worker did not survive a restore.
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) Under ¶
func (s *Store) Under(prefix string) []*longrunningpb.Operation
Under returns copies of every operation whose name starts with prefix, ordered by name.
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.