cachedshell

package
v0.0.0-...-667c717 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package cachedshell adds some helpful caching functionality to the go-ipfs-api shell

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Shell

type Shell struct {
	*shell.Shell
	Cache *cache.Cache
}

Shell embeds the go-ipfs-api shell with an extra *Cache

func NewShell

func NewShell(url string, c *cache.Cache) *Shell

NewShell takes the IPFS API url and an existing cache and returns a *Shell

func (*Shell) AddPermanentFile

func (s *Shell) AddPermanentFile(filename string) (string, error)

AddPermanentFile adds a file by its filename to IPFS returns the resulting object's hash. The hash is cached on a per-filename basis, so future calls to this method simply return the cached version of the hash for the same filename, assuming that the file has not changed.

func (*Shell) ClearPermanentFile

func (s *Shell) ClearPermanentFile(filename string)

ClearPermanentFile clears the cache value for the pernanent file hash previously added by AddPermanentFile.

Jump to

Keyboard shortcuts

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