cache

package
v0.3.2-beta Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Placeholders map[string]*placeholder
	// contains filtered or unexported fields
}

func NewCache

func NewCache(cacheFile string, metadata *metadata.Cache, ipfsUrl string) *Cache

Function which will provide a new cache struct An cache must be provided a file that it can read/write it's data to so that the cache is preserved between launches

func (*Cache) AddPlaceholder

func (c *Cache) AddPlaceholder(url string) (newPlaceholder *placeholder, hotWriter io.WriteCloser)

func (*Cache) FetchIpfs

func (c *Cache) FetchIpfs(ipfsPath string) (r io.ReadCloser, err error)

func (*Cache) HardResolve

func (c *Cache) HardResolve(resourceID string) (ipfsPath string, hotReader io.Reader, err error)

HardResolve will take the url and check it against the Placeholders it ensures that you will always get a reader, blocking if necessary

func (*Cache) Load

func (c *Cache) Load(filename string) error

Method which will load the provided cache data file. Will overwrite the internal state of the object. Should pretty much only be used when the object is created but it is left public in case a client needs to load old data or something

func (*Cache) QuickLookup

func (c *Cache) QuickLookup(url string) (ipfsPath string, exists bool)

func (*Cache) SoftResolve

func (c *Cache) SoftResolve(resourceID string) (ipfsPath string, err error)

func (*Cache) UrlCacheLookup

func (c *Cache) UrlCacheLookup(url string) (resourceID string, err error)

func (*Cache) Write

func (c *Cache) Write(filename string) error

Method which will write the cache data to the provided file. Will overwrite a file if one already exists at that location.

Jump to

Keyboard shortcuts

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