files

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package files declares the FileStore interface and implements a single in-memory FileStore

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("file data not found")

ErrNotFound is an error indicating that a requested file's data could not be found in a FileStore.

Functions

This section is empty.

Types

type FileStore

type FileStore interface {
	// FileData returns the data for the file described by the given path and
	// digest. Returns a NotFound error if the file data could not be found.
	FileData(path, digest string) ([]byte, error)
}

FileStore refers to an open Kythe file storage server.

type InMemoryStore

type InMemoryStore map[string][]byte

InMemoryStore is a FileStore that serves files based on an in-memory map from digest to file contents.

func InMemory

func InMemory() InMemoryStore

InMemory returns an empty InMemoryStore

func (InMemoryStore) AddData

func (s InMemoryStore) AddData(files ...*apb.FileData) error

AddData adds each FileData to the InMemoryStore based on their digests.

func (InMemoryStore) ClearData

func (s InMemoryStore) ClearData()

ClearData removes all file data contained within the InMemoryStore.

func (InMemoryStore) FileData

func (s InMemoryStore) FileData(path, digest string) ([]byte, error)

FileData implements a FileStore for an InMemoryStore.

Jump to

Keyboard shortcuts

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