rpc

package
v0.0.0-...-7aaaf19 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInterceptor

func NewInterceptor() *interceptor

Types

type BasicAuthResponse

type BasicAuthResponse struct {
	Token string
}

type CloudfsClient

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

wrap backend grpc api call

func NewCloudfsClient

func NewCloudfsClient(conn *grpc.ClientConn) *CloudfsClient

func (*CloudfsClient) BasicAuth

func (b *CloudfsClient) BasicAuth(ctx context.Context, username, password string) (*BasicAuthResponse, error)

func (*CloudfsClient) Delete

func (b *CloudfsClient) Delete(ctx context.Context, userToken, filename string) (*DeleteResponse, error)

func (*CloudfsClient) DownloadObject

func (b *CloudfsClient) DownloadObject(ctx context.Context, userToken, filename string) (*GetObjectResult, error)

func (*CloudfsClient) DownloadWithToken

func (b *CloudfsClient) DownloadWithToken(ctx context.Context, shareToken string) (*GetObjectResult, error)

func (*CloudfsClient) Objects

func (b *CloudfsClient) Objects(ctx context.Context, userToken, lastFilename string, limit int) (<-chan *Object, error)

func (*CloudfsClient) Register

func (b *CloudfsClient) Register(ctx context.Context, param RegisterParam) (*RegisterResult, error)

func (*CloudfsClient) ShareObject

func (b *CloudfsClient) ShareObject(ctx context.Context, userToken, filename string) (*SharedObject, error)

func (*CloudfsClient) UploadObject

func (b *CloudfsClient) UploadObject(ctx context.Context, userToken, filename, contentType string, size int64, body io.Reader) (*UploadResult, error)

type DeleteResponse

type DeleteResponse struct {
	DeletedAt time.Time
}

type GetObjectResult

type GetObjectResult struct {
	Filename    string
	ContentType string
	Size        int64
	Reader      io.ReadCloser
}

type GrpcServer

type GrpcServer struct {
	apipb.UnimplementedStorageServiceServer
	// contains filtered or unexported fields
}

func NewGrpcServer

func NewGrpcServer(objects *blob.Storage, accounts *user.Users) *GrpcServer

func (*GrpcServer) BasicAuth

func (*GrpcServer) DeleteObject

func (g *GrpcServer) DeleteObject(ctx context.Context, req *apipb.DeleteRequest) (*apipb.DeleteResponse, error)

func (*GrpcServer) DownloadObject

Download implements apipb.StorageServiceServer.

func (*GrpcServer) DownloadSharedObject

func (*GrpcServer) ListObject

func (*GrpcServer) Register

func (*GrpcServer) ShareObject

func (*GrpcServer) TokenAuth

func (*GrpcServer) UploadObject

Upload implements apipb.StorageServiceServer.

type Object

type Object struct {
	UserID       string
	Filename     string
	Sum          string
	Size         int64
	LastModified time.Time
	ContentType  string
	// contains filtered or unexported fields
}

func (*Object) Err

func (o *Object) Err() error

type RegisterParam

type RegisterParam struct {
	Username string
	Password string
}

type RegisterResult

type RegisterResult struct {
	UserID string
}

type SharedObject

type SharedObject struct {
	ShareToken string
	ValidUntil time.Time
}

type UploadResult

type UploadResult struct {
	Sum string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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