# README
Storage API
This API provides unified way of accessing any storage system.
It comes with the following implementation so far:
<a name="import>
URL Scheme | Description | Pacakge |
---|---|---|
file | Local file system | github.com/viant/toolbox/storage |
https | HTTP/s based system | github.com/viant/toolbox/storage |
mem | Memory file system | github.com/viant/toolbox/storage |
scp | SCP/SSH base systm | github.com/viant/toolbox/storage/scp |
s3 | Amazon Web Service S3 | github.com/viant/toolbox/storage/aws |
gs | Google Storage | github.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"
)
destinationURL := "gs://myBucket/set1/content.gz"
destinationCredentialFile = "gs-secret.json"
storageService, err := storage.NewServiceForURL(destinationURL, destinationCredentialFile)
# Functions
Archive archives supplied URL assets into zip writer.
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
ResetMemory reset memory root storage.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
file type.
folder type.
# Variables
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
No description provided by the author
# Type aliases
No description provided by the author
No description provided by the author
No description provided by the author