drivers

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package drivers abstracts different object storages, such as local, s3

Index

Constants

View Source
const S3_POLICY_EXPIRE_IN_HOURS = 24

S3_POLICY_EXPIRE_IN_HOURS how long access rights given to other node will be valid

Variables

View Source
var GSBUCKET string
View Source
var S3BUCKET string

S3BUCKET s3 bucket owned by this node

Functions

func GetSegmentData

func GetSegmentData(uri string) ([]byte, error)

func IsOwnExternal

func IsOwnExternal(uri string) bool

func IsOwnStorageGS

func IsOwnStorageGS(uri string) bool

IsOwnStorageGS returns true if uri points to Google Cloud Storage bucket owned by this node

func IsOwnStorageS3

func IsOwnStorageS3(uri string) bool

IsOwnStorageS3 returns true if uri points to S3 bucket owned by this node

Types

type MemoryOS

type MemoryOS struct {
	// contains filtered or unexported fields
}

func NewMemoryDriver

func NewMemoryDriver(baseURI *url.URL) *MemoryOS

func (*MemoryOS) GetSession

func (ostore *MemoryOS) GetSession(path string) *MemorySession

func (*MemoryOS) NewSession

func (ostore *MemoryOS) NewSession(path string) OSSession

type MemorySession

type MemorySession struct {
	// contains filtered or unexported fields
}

func (*MemorySession) EndSession

func (ostore *MemorySession) EndSession()

EndSession clears memory cache

func (*MemorySession) GetData

func (ostore *MemorySession) GetData(name string) []byte

GetData returns the cached data for a name.

A name can be an absolute or relative URI. An absolute URI has the following format: - ostore.os.baseURI + /stream/ + ostore.path + path + file The following are valid relative URIs: - /stream/ + ostore.path + path + file (if ostore.os.baseURI is empty) - ostore.path + path + file

func (*MemorySession) GetInfo

func (ostore *MemorySession) GetInfo() *net.OSInfo

func (*MemorySession) IsExternal

func (ostore *MemorySession) IsExternal() bool

func (*MemorySession) SaveData

func (ostore *MemorySession) SaveData(name string, data []byte) (string, error)

type OSDriver

type OSDriver interface {
	NewSession(path string) OSSession
}

OSDriver common interface for Object Storage

var NodeStorage OSDriver

NodeStorage is current node's primary driver

func NewGoogleDriver

func NewGoogleDriver(bucket, keyFileName string) (OSDriver, error)

func NewS3Driver

func NewS3Driver(region, bucket, accessKey, accessKeySecret string) OSDriver

type OSSession

type OSSession interface {
	SaveData(name string, data []byte) (string, error)
	EndSession()

	// Info in order to have this session used via RPC
	GetInfo() *net.OSInfo

	// Indicates whether data may be external to this node
	IsExternal() bool
}

func NewSession

func NewSession(info *net.OSInfo) OSSession

NewSession returns new session based on OSInfo received from the network

Jump to

Keyboard shortcuts

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