pachyderm: Index | Files

package gc

import ""


Package Files

client.go garbage_collector.go option.go schema.go util.go

func NewLocalDB Uses

func NewLocalDB() (*gorm.DB, error)

NewLocalDB creates a local database client. TODO The code for setting up a postgres client should be refactored into a db package similar to obj.

func Run Uses

func Run(ctx context.Context, objClient obj.Client, db *gorm.DB, opts ...Option) error

Run runs the garbage collector.

func WithGarbageCollector Uses

func WithGarbageCollector(objClient obj.Client, db *gorm.DB, f func(context.Context, Client) error, opts ...Option) error

WithGarbageCollector creates a garbage collector client for testing during the lifetime of the callback.

func WithLocalDB Uses

func WithLocalDB(f func(*gorm.DB) error) (retErr error)

WithLocalDB creates a local database client for testing during the lifetime of the callback.

func WithLocalGarbageCollector Uses

func WithLocalGarbageCollector(f func(context.Context, obj.Client, Client) error, opts ...Option) error

WithLocalGarbageCollector creates a local garbage collector client for testing during the lifetime of the callback.

type Client Uses

type Client interface {
    // ReserveChunk ensures that a chunk is not deleted by the garbage collector.
    // It will add a temporary reference to the given chunk, even
    // if it doesn't exist yet.  If the specified chunk is currently
    // being deleted, this call will block while it is being deleted.
    ReserveChunk(context.Context, string, string) error

    // CreateReference creates a reference.
    CreateReference(context.Context, *Reference) error
    // DeleteReference deletes a reference.
    DeleteReference(context.Context, *Reference) error

Client is the interface provided by the garbage collector client, for use on worker nodes. It will directly perform reference-counting operations on the cluster's Postgres database, and block on deleting chunks.

func NewClient Uses

func NewClient(db *gorm.DB) (Client, error)

NewClient creates a new client.

func NewMockClient Uses

func NewMockClient() Client

NewMockClient creates a new mock client.

type Option Uses

type Option func(gc *garbageCollector)

Option configures the garbage collector.

func ServiceEnvToOptions Uses

func ServiceEnvToOptions(env *serviceenv.ServiceEnv) ([]Option, error)

ServiceEnvToOptions converts a service environment configuration (specifically the garbage collection configuration) to a set of options.

func WithPolling Uses

func WithPolling(polling time.Duration) Option

WithPolling sets the polling duration.

func WithTimeout Uses

func WithTimeout(timeout time.Duration) Option

WithTimeout sets the temporary reference timeout duration.

type Reference Uses

type Reference struct {
    Sourcetype string
    Source     string
    Chunk      string

Reference describes a reference to a chunk in object storage. If a chunk has no references, it will be deleted.

* Sourcetype - the type of reference, one of:
 * 'temporary' - a temporary reference to a chunk.
 * 'chunk' - a cross-chunk reference, from one chunk to another.
 * 'semantic' - a reference to a chunk by some semantic name.
* Source - the source of the reference, this may be a temporary id, chunk id, or a
  semantic name.
* Chunk - the target chunk being referenced.

Package gc imports 12 packages (graph) and is imported by 2 packages. Updated 2020-07-02. Refresh now. Tools for package owners.