Documentation
¶
Overview ¶
Package services contains gRPC service implementations.
Index ¶
- type FileStore
- type FileSystemService
- func (fs *FileSystemService) Copy(ctx context.Context, cmd *commands.Copy) (*contract.File, error)
- func (fs *FileSystemService) Delete(ctx context.Context, cmd *commands.Delete) (*contract.File, error)
- func (fs *FileSystemService) Dump(_ *commands.Dump, stream contract.FileSystem_DumpServer) error
- func (fs *FileSystemService) List(ctx context.Context, cmd *commands.List) (*contract.Directory, error)
- func (fs *FileSystemService) Move(ctx context.Context, cmd *commands.Move) (*contract.File, error)
- func (fs *FileSystemService) Read(cmd *commands.Read, stream contract.FileSystem_ReadServer) error
- func (fs *FileSystemService) Stat(ctx context.Context, cmd *commands.Stat) (*contract.File, error)
- func (fs *FileSystemService) Write(stream contract.FileSystem_WriteServer) error
- type MetadataService
- func (m *MetadataService) Get(ctx context.Context, cmd *commands.GetMetadata) (*contract.MD, error)
- func (m *MetadataService) Search(cmd *commands.SearchMetadata, stream contract.Metadata_SearchServer) error
- func (m *MetadataService) Set(ctx context.Context, cmd *commands.SetMetadata) (*contract.Nothing, error)
- type MetadataStore
- type Node
- type ProxyService
- func (svc *ProxyService) Copy(ctx context.Context, cmd *commands.Copy) (*contract.File, error)
- func (svc *ProxyService) Delete(ctx context.Context, cmd *commands.Delete) (*contract.File, error)
- func (svc *ProxyService) Describe(ctx context.Context, cmd *commands.Describe) (*contract.Node, error)
- func (svc *ProxyService) Dump(cmd *commands.Dump, outbound contract.FileSystem_DumpServer) error
- func (svc *ProxyService) Get(ctx context.Context, cmd *commands.GetMetadata) (*contract.MD, error)
- func (svc *ProxyService) Join(ctx context.Context, cmd *commands.Join) (*contract.Nothing, error)
- func (svc *ProxyService) List(ctx context.Context, cmd *commands.List) (*contract.Directory, error)
- func (svc *ProxyService) Move(ctx context.Context, cmd *commands.Move) (*contract.File, error)
- func (svc *ProxyService) Read(cmd *commands.Read, outbound contract.FileSystem_ReadServer) error
- func (svc *ProxyService) Search(cmd *commands.SearchMetadata, inbound contract.Metadata_SearchServer) error
- func (svc *ProxyService) Set(ctx context.Context, cmd *commands.SetMetadata) (*contract.Nothing, error)
- func (svc *ProxyService) Stat(ctx context.Context, cmd *commands.Stat) (*contract.File, error)
- func (svc *ProxyService) Stats(ctx context.Context, cmd *commands.Statistics) (*contract.Statistics, error)
- func (svc *ProxyService) Write(inbound contract.FileSystem_WriteServer) error
- type RaftService
- type RaftStore
- type SnapshotSink
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) 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 ¶
func (fs *FileSystemService) Dump(_ *commands.Dump, stream contract.FileSystem_DumpServer) error
Dump the contents of the file system into the given stream
func (*FileSystemService) List ¶
func (fs *FileSystemService) List(ctx context.Context, cmd *commands.List) (*contract.Directory, error)
List handles an inbound gRPC request to list all files under a directory
func (*FileSystemService) Read ¶
func (fs *FileSystemService) Read(cmd *commands.Read, stream contract.FileSystem_ReadServer) error
Read a file's data from the file system and write it to the stream.
func (*FileSystemService) Write ¶
func (fs *FileSystemService) Write(stream contract.FileSystem_WriteServer) error
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 ¶
func (m *MetadataService) Get(ctx context.Context, cmd *commands.GetMetadata) (*contract.MD, error)
Get handles an inbound gRPC request to obtain metadata for a given file.
func (*MetadataService) Search ¶
func (m *MetadataService) Search(cmd *commands.SearchMetadata, stream contract.Metadata_SearchServer) error
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 ¶
func (m *MetadataService) Set(ctx context.Context, cmd *commands.SetMetadata) (*contract.Nothing, error)
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 ¶
Copy proxies an inbound gRPC copy request to the master node in the cluster.
func (*ProxyService) Delete ¶
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 ¶
Join proxies an inbound gRPC request to join the cluster. The request is forwarded to the cluster leader.
func (*ProxyService) List ¶
List proxies an inbound gRPC list request to a random node in the cluster.
func (*ProxyService) Move ¶
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 ¶
func (svc *ProxyService) Search(cmd *commands.SearchMetadata, inbound contract.Metadata_SearchServer) error
Search proxies an inbound gRPC request to search file metadata.
func (*ProxyService) Set ¶
func (svc *ProxyService) Set(ctx context.Context, cmd *commands.SetMetadata) (*contract.Nothing, error)
Set proxies an inbound gRPC request to set file metadata to the cluster leader.
func (*ProxyService) Stat ¶
Stat proxies an inbound gRPC stat request to a random node in the cluster.
func (*ProxyService) Stats ¶
func (svc *ProxyService) Stats(ctx context.Context, cmd *commands.Statistics) (*contract.Statistics, error)
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) Join ¶
Join handles an inbound gRPC request from another node to join the cluster.
func (*RaftService) Stats ¶
func (rs *RaftService) Stats(ctx context.Context, _ *commands.Statistics) (*contract.Statistics, error)
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.