cloud_storage_service

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

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

Go to latest
Published: Apr 20, 2017 License: MIT Imports: 5 Imported by: 1

README

Cloud Storage Service

Build Status

A gRPC service made with the Lile generator for storing object, files etc in cloud storage like Google Cloud Storage, AWS S3 or similar (PR's welcome!)

service CloudStorageService {
  rpc Store(StoreRequest) returns (StorageObject) {}
  rpc Delete(DeleteRequest) returns (DeleteResponse) {}
}

Details

The cloud storage service is for storing objects that other services may require or be used later by clients. An example would be uploading a photo along with a user account. In this scenario you would use the Store method to store the object in cloud storage, which will return you a filename and url. You can then store this for later use by a browser or similar.

Be aware that for this url to work the bucket in question must be public.

Specific object ACL's and URL generation are coming soon.

Docker

Builds (based on Alpine) of master (after test runs) are available at

docker pull lileio/cloud_storage_service

Setup

Google Cloud Storage

The service will create the cloud storage bucket on first run if it doesn't exist

GOOGLE_STORAGE_BUCKET=some-bucket
GOOGLE_STORAGE_PROJECT_ID=googleprojectid-20142
GOOGLE_STORAGE_LOCATION=eu
GOOGLE_APPLICATION_CREDENTIALS=/creds/google.json

Development

PR's are welcome. Testing currently is done end to end with communication with the services in question.

Documentation

Overview

Package cloud_storage_service is a generated protocol buffer package.

It is generated from these files:

cloud_storage_service.proto

It has these top-level messages:

StoreRequest
DeleteRequest
DeleteResponse
StorageObject

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCloudStorageServiceServer

func RegisterCloudStorageServiceServer(s *grpc.Server, srv CloudStorageServiceServer)

Types

type CloudStorageServiceClient

type CloudStorageServiceClient interface {
	Store(ctx context.Context, in *StoreRequest, opts ...grpc.CallOption) (*StorageObject, error)
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
}

func NewCloudStorageServiceClient

func NewCloudStorageServiceClient(cc *grpc.ClientConn) CloudStorageServiceClient

type CloudStorageServiceServer

type CloudStorageServiceServer interface {
	Store(context.Context, *StoreRequest) (*StorageObject, error)
	Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
}

type DeleteRequest

type DeleteRequest struct {
	Filename string `protobuf:"bytes,1,opt,name=filename" json:"filename,omitempty"`
}

func (*DeleteRequest) Descriptor

func (*DeleteRequest) Descriptor() ([]byte, []int)

func (*DeleteRequest) GetFilename

func (m *DeleteRequest) GetFilename() string

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) Reset

func (m *DeleteRequest) Reset()

func (*DeleteRequest) String

func (m *DeleteRequest) String() string

type DeleteResponse

type DeleteResponse struct {
	Filename string `protobuf:"bytes,1,opt,name=filename" json:"filename,omitempty"`
}

func (*DeleteResponse) Descriptor

func (*DeleteResponse) Descriptor() ([]byte, []int)

func (*DeleteResponse) GetFilename

func (m *DeleteResponse) GetFilename() string

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) Reset

func (m *DeleteResponse) Reset()

func (*DeleteResponse) String

func (m *DeleteResponse) String() string

type StorageObject

type StorageObject struct {
	Filename string `protobuf:"bytes,1,opt,name=filename" json:"filename,omitempty"`
	Url      string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"`
}

func (*StorageObject) Descriptor

func (*StorageObject) Descriptor() ([]byte, []int)

func (*StorageObject) GetFilename

func (m *StorageObject) GetFilename() string

func (*StorageObject) GetUrl

func (m *StorageObject) GetUrl() string

func (*StorageObject) ProtoMessage

func (*StorageObject) ProtoMessage()

func (*StorageObject) Reset

func (m *StorageObject) Reset()

func (*StorageObject) String

func (m *StorageObject) String() string

type StoreRequest

type StoreRequest struct {
	Filename string `protobuf:"bytes,1,opt,name=filename" json:"filename,omitempty"`
	// The raw data of the object to be stored
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}

func (*StoreRequest) Descriptor

func (*StoreRequest) Descriptor() ([]byte, []int)

func (*StoreRequest) GetData

func (m *StoreRequest) GetData() []byte

func (*StoreRequest) GetFilename

func (m *StoreRequest) GetFilename() string

func (*StoreRequest) ProtoMessage

func (*StoreRequest) ProtoMessage()

func (*StoreRequest) Reset

func (m *StoreRequest) Reset()

func (*StoreRequest) String

func (m *StoreRequest) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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