gc

package
v2.0.2-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GC

type GC interface {
	// Add adds GC task
	Add(Task) error

	// Run GC task
	Run(string) error

	// Run all registered GC tasks
	RunAll()

	// Serve running the GC task
	Serve()

	// Stop running the GC task
	Stop()
}

GC is the interface used for release resource

func New

func New(options ...Option) GC

New returns a new GC instence

type Logger

type Logger interface {
	// Infof logs routine messages for GC
	Infof(template string, args ...interface{})
	// Error logs error messages for GC
	Errorf(template string, args ...interface{})
}

Logger is the interface used in GC for logging

type Option

type Option func(g *gc)

Option is a functional option for configuring the GC

func WithLogger

func WithLogger(logger Logger) Option

WithLogger set the logger for GC

type Runner added in v2.0.1

type Runner interface {
	RunGC() error
}

type Task

type Task struct {
	ID       string
	Interval time.Duration
	Timeout  time.Duration
	Runner   Runner
}

Task is an struct used to run GC instance

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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