roller_cleanup

package
v0.0.0-...-5ddb564 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NeedsCleanup

func NeedsCleanup(ctx context.Context, db DB, rollerID string) (bool, error)

NeedsCleanup returns true if the given roller needs cleanup.

Types

type CleanupRequest

type CleanupRequest struct {
	RollerID      string
	NeedsCleanup  bool
	User          string
	Timestamp     time.Time
	Justification string
}

CleanupRequest describes a request to clean up a roller.

func (*CleanupRequest) Validate

func (req *CleanupRequest) Validate() error

Validate returns an error if the CleanupRequest is invalid.

type DB

type DB interface {
	// RequestCleanup requests or cancels an existing request for cleanup.
	RequestCleanup(ctx context.Context, req *CleanupRequest) error

	// History returns the requests for cleanup for a given roller, sorted most-
	// recent first. If greater than zero, `limit` controls the number of
	// results.
	History(ctx context.Context, rollerID string, limit int) ([]*CleanupRequest, error)
}

DB provides a mechanism for users (or the roller itself) to request cleanup (ie. deleting local data) of a roller.

func NewDBWithParams

func NewDBWithParams(ctx context.Context, project, instance string, ts oauth2.TokenSource) (DB, error)

NewDB returns a DB instance backed by Firestore, using the given params.

type FirestoreDB

type FirestoreDB struct {
	// contains filtered or unexported fields
}

FirestoreDB implements DB using Firestore.

func NewDB

func NewDB(ctx context.Context, client *firestore.Client) (*FirestoreDB, error)

NewDB returns a DB instance backed by the given firestore.Client.

func (*FirestoreDB) History

func (c *FirestoreDB) History(ctx context.Context, rollerID string, limit int) ([]*CleanupRequest, error)

History implements DB.

func (*FirestoreDB) RequestCleanup

func (c *FirestoreDB) RequestCleanup(ctx context.Context, req *CleanupRequest) error

RequestCleanup implements DB.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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