package
0.37.0
Repository: https://github.com/viant/toolbox.git
Documentation: pkg.go.dev

# README

Storage API

Deprecated - please use https://github.com/viant/afs API instead

This API provides unified way of accessing any storage system.

It comes with the following implementation so far:

<a name="import>

URL SchemeDescriptionPacakge
fileLocal file systemgithub.com/viant/toolbox/storage
httpsHTTP/s based systemgithub.com/viant/toolbox/storage
memMemory file systemgithub.com/viant/toolbox/storage
scpSCP/SSH base systmgithub.com/viant/toolbox/storage/scp
s3Amazon Web Service S3github.com/viant/toolbox/storage/aws
gsGoogle Storagegithub.com/viant/toolbox/storage/gs

type Service interface {
	//List returns a list of object for supplied url
	List(URL string) ([]Object, error)

	//Exists returns true if resource exists
	Exists(URL string) (bool, error)

	//Object returns a Object for supplied url
	StorageObject(URL string) (Object, error)

	//Download returns reader for downloaded storage object
	Download(object Object) (io.ReadCloser, error)

	//Upload uploads provided reader content for supplied storage object.
	Upload(URL string, reader io.Reader) error

	//Delete removes passed in storage object
	Delete(object Object) error

	//Register register schema with provided service
	Register(schema string, service Service) error

	//Closes storage service
	Close() error
}


//Object represents a storage object
type Object interface {
	//URL return storage url
	URL() string

	//Type returns storage type  StorageObjectFolderType or StorageObjectContentType
	Type() int

	//IsFolder returns true if object is a folder
	IsFolder() bool

	//IsContent returns true if object is a file
	IsContent() bool

	//Wrap wraps source storage object
	Wrap(source interface{})

	//Unwrap unwraps source storage object into provided target.
	Unwrap(target interface{}) error

	FileInfo() os.FileInfo
}

Usage:

    import (
    	"github.com/viant/toolbox/storage"
    	_ "github.com/viant/toolbox/storage/gs"
    	_ "github.com/viant/toolbox/storage/s3"
	
    )

    destinationURL := "gs://myBucket/set1/content.gz"
    destinationCredentialFile = "gs-secret.json"
	storageService, err := storage.NewServiceForURL(destinationURL, destinationCredentialFile)

    provider := storage.Registry().Get("s3")
    storageS3Service, err := provider("aws-secret.json")

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

Archive archives supplied URL assets into zip writer.
Archive archives supplied URL assets into zip writer with supplied filter.
Copy downloads objects from source URL to upload them to destination URL.
Download returns a download reader for supplied URL.
DownloadText returns a text for supplied URL.
GenerateStorageCode create a *.go files with statically scanned content from source URL.
NewAbstractStorageObject creates a new abstract storage object.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
creates a new memory service.
creates a new private memory service.
NewService creates a new storage service.
NewServiceForURL creates a new storage service for provided URL scheme and optional credential file.
NewStorageMapperHandler creates a template handler for generating go file that write static content into memory service.
No description provided by the author
Registry returns new provider.
ResetMemory reset memory root storage.
Tar tar archives supplied URL assets into zip writer.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
file type.
folder type.

# Variables

No description provided by the author
HTTPClientProvider represents http client provider.
MemoryRoot represents memory root storage.

# Structs

AbstractObject represents abstract storage object.
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

Object represents a storage object.
Service represents abstract way to accessing local or remote storage.

# Type aliases

No description provided by the author
No description provided by the author
Provider represetns a service provider.