weed

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2017 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Seaweed

type Seaweed struct {
	// Connection URI for the master.
	Master string

	// Volume cache to use if CacheVolumes is true.
	VolumeCache *VolumeCache

	// Lookup timeout for fetching volumes from master.
	LookupTimeout time.Duration
}

Seaweed allows for retrieving files from a SeaweedFS cluster.

func New

func New(masterURI string, lookupTimeout time.Duration) *Seaweed

New creates a new instance of Seaweed.

func (*Seaweed) Get

func (s *Seaweed) Get(writer io.Writer, fid string, query string) (int, error)

func (*Seaweed) Ping

func (s *Seaweed) Ping() error

type VolumeCache

type VolumeCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

VolumeCache stores a volume ID => volume URL map used for caching volume lookup responses from the master of a SeaweedFS cluster.

func (*VolumeCache) Add

func (v *VolumeCache) Add(id uint32, urls []string)

Add adds a volume ID => location URL slice mapping to the volume cache.

func (*VolumeCache) Empty

func (v *VolumeCache) Empty()

Empty clears all data and returns the VolumeCache to it's initial state.

func (*VolumeCache) Get

func (v *VolumeCache) Get(id uint32) []string

Get returns all volume server URLs for a given volume ID.

func (*VolumeCache) GetNext

func (v *VolumeCache) GetNext(id uint32) string

GetNext returns the n+1th location URL for the given volume ID, n is tracked internally.

func (*VolumeCache) Remove

func (v *VolumeCache) Remove(id uint32)

Remove removes a volume from the volume cache.

Jump to

Keyboard shortcuts

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