services

package
v0.0.0-...-6ed8234 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package services contains gRPC service implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

type FileStore interface {
	Reader(string) (filesystem.FileReader, error)
	Writer(string) io.Writer
	Delete(string) error
	Move(string, string) error
	Copy(string, string) error
	Stat(string) (*filesystem.FileInfo, error)
	List(string) ([]*filesystem.FileInfo, error)
	FSM() raft.FSM
}

The FileStore interface defines types that can interact with the underlying file system.

type FileSystemService

type FileSystemService struct {
	ChunkSize     int // Maximum amount of data per chunk read
	Store         FileStore
	EncryptionKey []byte
}

The FileSystemService contains methods that handle inbound gRPC commands to perform operations against the underlying file system.

func (*FileSystemService) Copy

func (fs *FileSystemService) Copy(ctx context.Context, cmd *commands.Copy) (*contract.File, error)

Copy a file from one location to another.

func (*FileSystemService) Delete

func (fs *FileSystemService) Delete(ctx context.Context, cmd *commands.Delete) (*contract.File, error)

Delete a file from the filesystem by name.

func (*FileSystemService) Dump

Dump the contents of the file system into the given stream

func (*FileSystemService) List

List handles an inbound gRPC request to list all files under a directory

func (*FileSystemService) Move

func (fs *FileSystemService) Move(ctx context.Context, cmd *commands.Move) (*contract.File, error)

Move a file from one location to another.

func (*FileSystemService) Read

Read a file's data from the file system and write it to the stream.

func (*FileSystemService) Stat

func (fs *FileSystemService) Stat(ctx context.Context, cmd *commands.Stat) (*contract.File, error)

Stat returns info on the requested file.

func (*FileSystemService) Write

Write data from the stream to a file, if the file already exists, it is appended to.

type MetadataService

type MetadataService struct {
	Metadata   MetadataStore
	FileSystem FileStore
}

The MetadataService type is used to handle inbound gRPC requests for reading/changing file metadata.

func (*MetadataService) Get

Get handles an inbound gRPC request to obtain metadata for a given file.

func (*MetadataService) Search

Search handles an inbound gRPC request to search for metadata using a provided term. Each file metadata that matches the given term will be written to the stream.

func (*MetadataService) Set

Set handles an inbound gRPC request to update metadata for a given file.

type MetadataStore

type MetadataStore interface {
	ForEach(fn func(md metadata.Metadata) error) error
	Get(loc string) (metadata.Metadata, error)
	Set(md metadata.Metadata) (metadata.Metadata, error)
}

The MetadataStore interface describes types that can manipulate and obtain file metadata.

type Node

type Node struct {
	Raft contract.RaftClient       // Client for raft request
	FS   contract.FileSystemClient // Client for file system requests
	MD   contract.MetadataClient   // Client for metadata requests.
	Conn *grpc.ClientConn          // Underlying gRPC connection
}

The Node type contains fields for interacting with a node in the cluster.

type ProxyService

type ProxyService struct {
	Nodes []Node
	// contains filtered or unexported fields
}

The ProxyService type is a gRPC implementation that makes write requests against the leader node in the blobby cluster and read requests against random nodes in the cluster.

func (*ProxyService) Copy

func (svc *ProxyService) Copy(ctx context.Context, cmd *commands.Copy) (*contract.File, error)

Copy proxies an inbound gRPC copy request to the master node in the cluster.

func (*ProxyService) Delete

func (svc *ProxyService) Delete(ctx context.Context, cmd *commands.Delete) (*contract.File, error)

Delete proxies an inbound gRPC delete request to the master node in the cluster.

func (*ProxyService) Describe

func (svc *ProxyService) Describe(ctx context.Context, cmd *commands.Describe) (*contract.Node, error)

Describe proxies an inbound gRPC request to describe a raft node.

func (*ProxyService) Dump

func (svc *ProxyService) Dump(cmd *commands.Dump, outbound contract.FileSystem_DumpServer) error

Dump proxies an inbound gRPC dump request to a random node in the cluster.

func (*ProxyService) Get

func (svc *ProxyService) Get(ctx context.Context, cmd *commands.GetMetadata) (*contract.MD, error)

Get proxies an inbound gRPC request to get file metadata.

func (*ProxyService) Join

func (svc *ProxyService) Join(ctx context.Context, cmd *commands.Join) (*contract.Nothing, error)

Join proxies an inbound gRPC request to join the cluster. The request is forwarded to the cluster leader.

func (*ProxyService) List

func (svc *ProxyService) List(ctx context.Context, cmd *commands.List) (*contract.Directory, error)

List proxies an inbound gRPC list request to a random node in the cluster.

func (*ProxyService) Move

func (svc *ProxyService) Move(ctx context.Context, cmd *commands.Move) (*contract.File, error)

Move proxies an inbound gRPC move request to the master node in the cluster.

func (*ProxyService) Read

func (svc *ProxyService) Read(cmd *commands.Read, outbound contract.FileSystem_ReadServer) error

Read proxies an inbound gRPC read request to a random node in the cluster.

func (*ProxyService) Search

Search proxies an inbound gRPC request to search file metadata.

func (*ProxyService) Set

Set proxies an inbound gRPC request to set file metadata to the cluster leader.

func (*ProxyService) Stat

func (svc *ProxyService) Stat(ctx context.Context, cmd *commands.Stat) (*contract.File, error)

Stat proxies an inbound gRPC stat request to a random node in the cluster.

func (*ProxyService) Stats

Stats proxies an inbound gRPC request to obtain cluster statistics.

func (*ProxyService) Write

func (svc *ProxyService) Write(inbound contract.FileSystem_WriteServer) error

Write proxies an inbound gRPC write request to the master node in the cluster.

type RaftService

type RaftService struct {
	Store RaftStore
}

The RaftService type exposes endpoints for managing the underlying raft cluster used by the application.

func (*RaftService) Describe

func (rs *RaftService) Describe(ctx context.Context, _ *commands.Describe) (*contract.Node, error)

Describe handles an inbound gRPC request to describe the raft node.

func (*RaftService) Join

func (rs *RaftService) Join(ctx context.Context, cmd *commands.Join) (*contract.Nothing, error)

Join handles an inbound gRPC request from another node to join the cluster.

func (*RaftService) Stats

Stats handles an inbound gRPC request to obtain the current raft statistics from the cluster.

type RaftStore

type RaftStore interface {
	Join(string, string) error
	DescribeNode() *store.Node
	Stats() map[string]string
}

The RaftStore interface defines types that can interact with the underlying raft cluster.

type SnapshotSink

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

The SnapshotSink type is used to write the file system snapshot to a gRPC stream.

func (*SnapshotSink) Cancel

func (ss *SnapshotSink) Cancel() error

Cancel does nothing

func (*SnapshotSink) Close

func (ss *SnapshotSink) Close() error

Close does nothing

func (*SnapshotSink) ID

func (ss *SnapshotSink) ID() string

ID returns a blank string

func (*SnapshotSink) Write

func (ss *SnapshotSink) Write(buf []byte) (int, error)

Write snapshot data to the stream.

Jump to

Keyboard shortcuts

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