storagetest

package
v0.0.0-...-7c4ed6d Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2017 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package storagetest implements simple types and utility functions to help test implementations of storage.S.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DummyStorage

func DummyStorage(*storage.Opts) (storage.Storage, error)

DummyStorage returns a storage.Storage that does nothing.

func Memory

func Memory() storage.Storage

Memory returns a storage.Storage implementation that stores data in memory. It is safe for concurrent use.

Types

type ExpectDownloadCapturePut

type ExpectDownloadCapturePut struct {

	// Expectations for calls to Download
	Ref  []string
	Data [][]byte
	// Storage for calls to Put
	PutRef      []string
	PutContents [][]byte
	// contains filtered or unexported fields
}

ExpectDownloadCapturePut inspects all calls to Download with the given Ref and if it matches, it returns Data. Ref matches are strictly sequential. It also captures all Put requests.

func (*ExpectDownloadCapturePut) Delete

func (m *ExpectDownloadCapturePut) Delete(ref string) error

func (*ExpectDownloadCapturePut) Download

func (e *ExpectDownloadCapturePut) Download(ref string) ([]byte, error)

Download implements storage.Storage.

func (*ExpectDownloadCapturePut) LinkBase

func (m *ExpectDownloadCapturePut) LinkBase() (base string, err error)

func (*ExpectDownloadCapturePut) Put

func (e *ExpectDownloadCapturePut) Put(ref string, contents []byte) error

Put implements storage.Storage.

Jump to

Keyboard shortcuts

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