gc

package
v0.1.0-beta-3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 5 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(string, Task)

	// 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, error)

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 WithInterval

func WithInterval(interval time.Duration) Option

WithInterval set the interval for GC collection

func WithLogger

func WithLogger(logger Logger) Option

WithLogger set the logger for GC

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout set the timeout for GC collection

type Task

type Task interface {
	// The actual function to run GC task
	RunGC() error
}

Task is an interface 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