cache

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cache implements the Fs cache

Index

Constants

This section is empty.

Variables

View Source
var (
	// JobGetJobID for internal use only
	JobGetJobID func(context.Context) (int64, bool)
	// JobOnFinish for internal use only
	JobOnFinish func(int64, func()) (func(), error)
)

To avoid circular dependencies these are filled in by fs/rc/jobs/job.go

Functions

func Canonicalize

func Canonicalize(fsString string) string

Canonicalize looks up fsString in the mapping from user supplied names to canonical names and return the canonical form

func Clear

func Clear()

Clear removes everything from the cache

func ClearConfig

func ClearConfig(name string) (deleted int)

ClearConfig deletes all entries which were based on the config name passed in

Returns number of entries deleted

func ClearMappings

func ClearMappings()

ClearMappings removes everything from remap and childParentMap

func ClearMappingsPrefix

func ClearMappingsPrefix(prefix string) (deleted int)

ClearMappingsPrefix deletes all mappings to parents with given prefix

Returns number of entries deleted

func Entries

func Entries() int

Entries returns the number of entries in the cache

func EntriesWithPinCount

func EntriesWithPinCount() (pinned, unpinned int)

EntriesWithPinCount returns the number of pinned and unpinned entries in the cache

Each entry is counted only once, regardless of entry.pinCount

func Get

func Get(ctx context.Context, fsString string) (f fs.Fs, err error)

Get gets an fs.Fs named fsString either from the cache or creates it afresh

func GetArr

func GetArr(ctx context.Context, fsStrings []string) (f []fs.Fs, err error)

GetArr gets []fs.Fs from []fsStrings either from the cache or creates it afresh

func GetFn

func GetFn(ctx context.Context, fsString string, create func(ctx context.Context, fsString string) (fs.Fs, error)) (f fs.Fs, err error)

GetFn gets an fs.Fs named fsString either from the cache or creates it afresh with the create function

func Pin

func Pin(f fs.Fs)

Pin f into the cache until Unpin is called

func PinUntilFinalized

func PinUntilFinalized(f fs.Fs, x interface{})

PinUntilFinalized pins f into the cache until x is garbage collected

This calls runtime.SetFinalizer on x so it shouldn't have a finalizer already.

func Put

func Put(fsString string, f fs.Fs)

Put puts an fs.Fs named fsString into the cache

func PutErr

func PutErr(fsString string, f fs.Fs, err error)

PutErr puts an fs.Fs named fsString into the cache with err

func Unpin

func Unpin(f fs.Fs)

Unpin f from the cache

Types

This section is empty.

Jump to

Keyboard shortcuts

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