fic

package
v0.0.0-...-4b9bf86 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package fic represents an os.FileInfo based cache of file data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cache

func Cache(inp <-chan string) <-chan *FiCache

Cache launches a inp listener and returns a channel to receive a new populated FiCache (like a done channel) upon close of inp.

Types

type FiCache

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

FiCache provides cached file data for any os.FileInfo

func New

func New() *FiCache

New returns a fresh FiCache, ready to be populated via Register, or via Done (listening to a channel where os.FileInfo'es are supplied), and subsequently queried via Lookup or LookupData.

func (*FiCache) Done

func (fc *FiCache) Done(inp <-chan string) <-chan struct{}

Done launches a inp listener and returns a done channel

Note: while listening, the FiCache is Locked,
and any error upon registration is silently ignored

func (*FiCache) Lookup

func (fc *FiCache) Lookup(key string) (Item, bool)

Lookup returns the FsData object assigned to key (if any) or false

func (*FiCache) LookupData

func (fc *FiCache) LookupData(key string) string

LookupData returns the data assigned to the FsData of key (or an empty string)

func (*FiCache) Register

func (fc *FiCache) Register(key string) error

Register a key in the FiCache; related data is refreshed, iff underlying os.FileInfo has changed.

type Item

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

Item represents the data (as read upon it's creation) of a related os.FileInfo

Note: Item is immutable, and as such safe for concurrent use.

Jump to

Keyboard shortcuts

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