gcplro

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func Done

func Done(name string, meta, resp proto.Message) (*longrunningpb.Operation, error)

Done builds a successfully finished operation.

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 New

func New(name string) *Store

New creates an empty Store.

func (*Store) AbortPending

func (s *Store) AbortPending(st *status.Status)

AbortPending resolves every unfinished operation with st, for operations whose worker did not survive a restore.

func (*Store) CancelOperation

CancelOperation succeeds without effect: a finished operation cannot be cancelled.

func (*Store) DeleteOperation

DeleteOperation removes the named operation.

func (*Store) GetOperation

GetOperation returns the named operation.

func (*Store) ListOperations

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

Put records op and returns a copy of it.

func (*Store) Reset

func (s *Store) Reset()

Reset drops every operation.

func (*Store) Restore

func (s *Store) Restore(snap map[string]jsontext.Value) error

Restore replaces the stored operations with a Snapshot result.

func (*Store) SetClock

func (s *Store) SetClock(now func() time.Time)

SetClock makes retention follow now instead of the wall clock.

func (*Store) SetLimits

func (s *Store) SetLimits(maxOps int, maxAge time.Duration)

SetLimits replaces the retention bounds for finished operations.

func (*Store) Snapshot

func (s *Store) Snapshot() map[string]jsontext.Value

Snapshot serialises every operation as protojson.

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

WaitOperation returns the named operation at once because every operation is already finished.

Jump to

Keyboard shortcuts

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