s420

package module
v0.0.0-...-a5e9413 Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: MIT Imports: 7 Imported by: 0

README

S420

s420 is a service related with storage, it use minio to create a complete useful storage service

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Storage  Storage  `yaml:"storage"`
	Service  Service  `yaml:"service"`
	Public   Public   `yaml:"public"`
	Security Security `yaml:"security"`
}

Config is the struct to config your s420

func NewConfigFromFile

func NewConfigFromFile(filePath string) (*Config, error)

NewConfigFromFile returns a new config struct

type ContentType

type ContentType string

ContentType ...

type File

type File struct {
	Path      string
	Name      string
	Size      int64
	MD5       string
	Type      ContentType
	Thumbnail []byte
}

File describes a file saved on your storage system

type GrpcService

type GrpcService struct {
	Store StorageSystem
}

GrpcService is a s420 service

func (*GrpcService) GetObject

func (s *GrpcService) GetObject(c context.Context, params *s420con.ObjectPath) (*s420con.GetResponse, error)

GetObject implements a s420 server

func (*GrpcService) GetObjectFromBucket

func (s *GrpcService) GetObjectFromBucket(c context.Context, params *s420con.ObjectFromBucket) (*s420con.GetResponse, error)

GetObjectFromBucket implements a s420 server

func (*GrpcService) SaveNewObject

func (s *GrpcService) SaveNewObject(c context.Context, params *s420con.NewObjectParams) (*s420con.SaveResponse, error)

SaveNewObject implements a s420 server

func (*GrpcService) SaveObjectInBucket

func (s *GrpcService) SaveObjectInBucket(c context.Context, params *s420con.NewObjectInBucket) (*s420con.SaveResponse, error)

SaveObjectInBucket implements a s420 server

type HumanClient

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

HumanClient describe the public client to get access to storage

func NewHumanClient

func NewHumanClient(store StorageSystem, c Public, r *gin.Engine) *HumanClient

NewHumanClient returns a new public client

func (*HumanClient) Run

func (client *HumanClient) Run()

Run launch the http instance of the client

type ObjectOptions

type ObjectOptions struct {
	ContentType string
}

ObjectOptions ...

type Public

type Public struct {
	Prefix string `yaml:"prefix"`
	Port   int64  `yaml:"port"`
}

Public is the public configuration

type SaveResponse

type SaveResponse struct {
	OK       bool
	FilePath string
}

SaveResponse ...

type Security

type Security struct {
	ServerCertPath string `yaml:"server_cert_path"`
	ServerKeyPath  string `yaml:"server_key_path"`
}

Security describe the certificates path

type Service

type Service struct {
	Port int64 `yaml:"port"`
}

Service define the grpc service configuration

type Storage

type Storage struct {
	Backend         string `yaml:"backend"`
	Endpoint        string `yaml:"endpoint"`
	AccessKey       string `yaml:"access_key"`
	SecretAccessKey string `yaml:"secret_access_key"`
	UseSSL          bool   `yaml:"use_ssl"`
}

Storage define the config to storage system (default: minio)

type StorageSystem

type StorageSystem interface {
	SaveObjectInBucket(bucket string, fileName string, data []byte, options *ObjectOptions) (*SaveResponse, error)
	GetObjectFromBucket(bucket string, path string) ([]byte, ContentType, error) // data, content-type, error
	SaveNewObject(path string, data []byte, options *ObjectOptions) (*SaveResponse, error)
	GetObject(path string) ([]byte, ContentType, error) // data, content-type, error
}

StorageSystem represent the store struct to dialog with minio or any store type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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