Documentation
¶
Index ¶
- Constants
- func GrpcDialHealthy(o *GrpcDialOpts) (*grpc.ClientConn, error)
- func HashToBytes(hash Hash) []byte
- func HashesToHashBytes(hashes []Hash) [][]byte
- func HealthCheck(conn *grpc.ClientConn, service string) error
- func LinkValidationToStatus(e *remote.ErrObjectLinkValidation) (*status.Status, error)
- func OutputBytesFromHashes(hashes []Hash) [][]byte
- func OutputBytesFromSHA256(shas []SHA256) [][]byte
- func ProxyDirector(mainServiceName string, proxyPrefixToConnManager map[string]ConnectionManager) proxy.StreamDirector
- func ServerVersionMetadataInterceptor(serviceName, clientMinVersion, serverVersion string) grpc.UnaryServerInterceptor
- func ServerVersionMetadataStreamInterceptor(serviceName, clientMinVersion, serverVersion string) grpc.StreamServerInterceptor
- func UnwrapMissingLinkError(err error) error
- func WrapErrorInStatus(err error) error
- type ByteCounter
- func (b *ByteCounter) HandleConn(ctx context.Context, s stats.ConnStats)
- func (b *ByteCounter) HandleRPC(ctx context.Context, s stats.RPCStats)
- func (b *ByteCounter) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (b *ByteCounter) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type BytesStatHandler
- type Chunker
- type ConnectionManager
- type GrpcDialOpts
- type Hash
- type PBClient
- func (c *PBClient) AddMapResult(ctx context.Context, from remote.Hash, to remote.Hash) error
- func (c *PBClient) GetObject(ctx context.Context, key remote.Hash) (remote.ContentReadCloser, error)
- func (c *PBClient) GetRefs(ctx context.Context, server string, project string, refs []string) ([]remote.Hash, error)
- func (c *PBClient) Headers(ctx context.Context, keys []remote.Hash) ([]entities.ObjectHeader, error)
- func (c *PBClient) MapResults(ctx context.Context, from remote.Hash) ([]remote.Hash, error)
- func (c *PBClient) Mark(ctx context.Context, hash remote.Hash, key string, value string) (int64, error)
- func (c *PBClient) PutObject(ctx context.Context, key remote.Hash, reader remote.ContentReadCloser) error
- func (c *PBClient) PutRefs(ctx context.Context, server string, project string, refs []remote.RefHash) error
- func (c *PBClient) SHA256(ctx context.Context, keys []remote.Hash) ([]entities.SHA256, error)
- func (c *PBClient) SearchRefs(ctx context.Context, server string, project string, refPrefix string, ...) ([]remote.ProjectRefHash, error)
- func (c *PBClient) Version(ctx context.Context) (string, error)
- func (c *PBClient) WhoAmI(ctx context.Context) (string, error)
- type PBServer
- func (s *PBServer) AddMapResult(ctx context.Context, req *pb.AddMapResultRequest) (*pb.AddMapResultReply, error)
- func (s *PBServer) GetObject(req *pb.GetObjectRequest, stream pb.ABFS_GetObjectServer) (retErr error)
- func (s *PBServer) GetRefs(ctx context.Context, req *pb.GetRefsRequest) (*pb.GetRefsReply, error)
- func (s *PBServer) GetVersion(ctx context.Context, req *pb.GetVersionRequest) (*pb.GetVersionReply, error)
- func (s *PBServer) Headers(ctx context.Context, req *pb.HeadersRequest) (*pb.HeadersReply, error)
- func (s *PBServer) MapResults(ctx context.Context, req *pb.MapResultsRequest) (*pb.MapResultsReply, error)
- func (s *PBServer) PutObject(stream pb.ABFS_PutObjectServer) error
- func (s *PBServer) PutRefs(ctx context.Context, req *pb.PutRefsRequest) (*pb.PutRefsReply, error)
- func (s *PBServer) SHA256(ctx context.Context, req *pb.SHA256Request) (*pb.SHA256Reply, error)
- func (s *PBServer) SearchRefs(ctx context.Context, req *pb.SearchRefsRequest) (*pb.SearchRefsReply, error)
- func (s *PBServer) WhoAmI(ctx context.Context, req *pb.WhoAmIRequest) (*pb.WhoAmIReply, error)
- type RandomConnectionManager
- type SHA256
- type Stream
Constants ¶
const (
MaxMessageSize = int(pb.ServiceConstants_MAX_CHUNK_BYTES)
)
Variables ¶
This section is empty.
Functions ¶
func GrpcDialHealthy ¶
func GrpcDialHealthy(o *GrpcDialOpts) (*grpc.ClientConn, error)
GrpcDialHealthy is like grpc.Dial but returns error on an unhealthy connection
func HashToBytes ¶
func HashesToHashBytes ¶
func HealthCheck ¶
func HealthCheck(conn *grpc.ClientConn, service string) error
func LinkValidationToStatus ¶
func LinkValidationToStatus(e *remote.ErrObjectLinkValidation) (*status.Status, error)
func OutputBytesFromHashes ¶
func OutputBytesFromSHA256 ¶
func ProxyDirector ¶
func ProxyDirector(mainServiceName string, proxyPrefixToConnManager map[string]ConnectionManager) proxy.StreamDirector
ProxyDirector returns a function that is intended to be used with the "github.com/mwitkow/grpc-proxy/proxy" package. Example:
grpc.NewServer(grpc.UnknownServiceHandler(proxy.TransparentHandler(abfsgrpc.ProxyDirector(pb.ABFS_ServiceDesc.ServiceName, proxyPrefixToConnection))))
func ServerVersionMetadataInterceptor ¶
func ServerVersionMetadataInterceptor(serviceName, clientMinVersion, serverVersion string) grpc.UnaryServerInterceptor
ServerVersionMetadataInterceptor is meant to be used with grpc.UnaryInterceptor. Example:
grpc.NewServer( grpc.UnaryInterceptor(abfsgrpc.ServerVersionMetadataInterceptor(pb.ARES_ServiceDesc.ServiceName)), )
func ServerVersionMetadataStreamInterceptor ¶
func ServerVersionMetadataStreamInterceptor(serviceName, clientMinVersion, serverVersion string) grpc.StreamServerInterceptor
ServerVersionMetadataStreamInterceptor is meant to be used with grpc.StreamInterceptor. Example:
grpc.NewServer( grpc.StreamInterceptor(abfsgrpc.ServerVersionMetadataStreamInterceptor(pb.ARES_ServiceDesc.ServiceName)), )
func UnwrapMissingLinkError ¶
UnwrapMissingLinkError looks for a grpc status error that has any ObjectLink details and unwraps it into a native Go error if found.
func WrapErrorInStatus ¶
WrapErrorInStatus looks for specific typed errors (like ErrObjectLinkValidation or ErrPermissionDenied) and wraps them in a grpc Status error if found.
Types ¶
type ByteCounter ¶
type ByteCounter struct {
// contains filtered or unexported fields
}
func (*ByteCounter) HandleConn ¶
func (b *ByteCounter) HandleConn(ctx context.Context, s stats.ConnStats)
func (*ByteCounter) HandleRPC ¶
func (b *ByteCounter) HandleRPC(ctx context.Context, s stats.RPCStats)
func (*ByteCounter) TagConn ¶
func (b *ByteCounter) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
func (*ByteCounter) TagRPC ¶
func (b *ByteCounter) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
type BytesStatHandler ¶
type ConnectionManager ¶
type ConnectionManager interface {
Select() (*grpc.ClientConn, error)
}
type GrpcDialOpts ¶
type GrpcDialOpts struct {
ServiceName string
Address string
BytesStatHandler BytesStatHandler
ClientVersion string
ServerMinVersion string
TokenSource auth.TokenSource
RootCAFile string
RetryPolicy string
DisableTLS bool
SkipHealthCheck bool
}
GrpcDialOpts contains the options for GrpcDialHealthy.
type PBClient ¶
type PBClient struct {
// contains filtered or unexported fields
}
func NewPBClient ¶
func NewPBClient(pb pb.ABFSClient) *PBClient
func (*PBClient) AddMapResult ¶
AddMapResult implements remote.RemoteProvider.
func (*PBClient) GetObject ¶
func (c *PBClient) GetObject(ctx context.Context, key remote.Hash) (remote.ContentReadCloser, error)
GetObject implements remote.RemoteProvider.
func (*PBClient) GetRefs ¶
func (c *PBClient) GetRefs(ctx context.Context, server string, project string, refs []string) ([]remote.Hash, error)
GetRefs implements remote.RemoteProvider.
func (*PBClient) Headers ¶
func (c *PBClient) Headers(ctx context.Context, keys []remote.Hash) ([]entities.ObjectHeader, error)
Headers implements remote.RemoteProvider.
func (*PBClient) MapResults ¶
MapResults implements remote.RemoteProvider.
func (*PBClient) Mark ¶
func (c *PBClient) Mark(ctx context.Context, hash remote.Hash, key string, value string) (int64, error)
Mark implements remote.RemoteProvider.
func (*PBClient) PutObject ¶
func (c *PBClient) PutObject(ctx context.Context, key remote.Hash, reader remote.ContentReadCloser) error
PutObject implements remote.RemoteProvider.
func (*PBClient) PutRefs ¶
func (c *PBClient) PutRefs(ctx context.Context, server string, project string, refs []remote.RefHash) error
PutRefs implements remote.RemoteProvider.
func (*PBClient) SearchRefs ¶
func (c *PBClient) SearchRefs(ctx context.Context, server string, project string, refPrefix string, limit int) ([]remote.ProjectRefHash, error)
SearchRefs implements remote.RemoteProvider.
type PBServer ¶
type PBServer struct {
pb.UnimplementedABFSServer
// contains filtered or unexported fields
}
func NewPBServer ¶
func NewPBServer(server remote.RemoteProvider) *PBServer
func (*PBServer) AddMapResult ¶
func (s *PBServer) AddMapResult(ctx context.Context, req *pb.AddMapResultRequest) (*pb.AddMapResultReply, error)
AddMapResult implements ABFSServer.
func (*PBServer) GetObject ¶
func (s *PBServer) GetObject(req *pb.GetObjectRequest, stream pb.ABFS_GetObjectServer) (retErr error)
GetObject implements ABFSServer.
func (*PBServer) GetRefs ¶
func (s *PBServer) GetRefs(ctx context.Context, req *pb.GetRefsRequest) (*pb.GetRefsReply, error)
GetRefs implements ABFSServer.
func (*PBServer) GetVersion ¶
func (s *PBServer) GetVersion(ctx context.Context, req *pb.GetVersionRequest) (*pb.GetVersionReply, error)
GetVersion implements ABFSServer.
func (*PBServer) Headers ¶
func (s *PBServer) Headers(ctx context.Context, req *pb.HeadersRequest) (*pb.HeadersReply, error)
Headers implements ABFSServer.
func (*PBServer) MapResults ¶
func (s *PBServer) MapResults(ctx context.Context, req *pb.MapResultsRequest) (*pb.MapResultsReply, error)
MapResults implements ABFSServer.
func (*PBServer) PutObject ¶
func (s *PBServer) PutObject(stream pb.ABFS_PutObjectServer) error
PutObject implements ABFSServer.
func (*PBServer) PutRefs ¶
func (s *PBServer) PutRefs(ctx context.Context, req *pb.PutRefsRequest) (*pb.PutRefsReply, error)
PutRefs implements ABFSServer.
func (*PBServer) SHA256 ¶
func (s *PBServer) SHA256(ctx context.Context, req *pb.SHA256Request) (*pb.SHA256Reply, error)
SHA256 implements ABFSServer.
func (*PBServer) SearchRefs ¶
func (s *PBServer) SearchRefs(ctx context.Context, req *pb.SearchRefsRequest) (*pb.SearchRefsReply, error)
SearchRefs implements ABFSServer.
func (*PBServer) WhoAmI ¶
func (s *PBServer) WhoAmI(ctx context.Context, req *pb.WhoAmIRequest) (*pb.WhoAmIReply, error)
WhoAmI implements ABFSServer. This call does not get delegated to the s.server RemoteProvider because it is not a function of the backing store. One implementation can be used.
type RandomConnectionManager ¶
type RandomConnectionManager struct {
// contains filtered or unexported fields
}
func NewRandomConnectionManager ¶
func NewRandomConnectionManager(conns []*grpc.ClientConn) *RandomConnectionManager
NewRandomConnectionManager creates a new connection manager that selects a connection randomly.
func (*RandomConnectionManager) Add ¶
func (m *RandomConnectionManager) Add(conn *grpc.ClientConn)
Add adds a new connection to the manager.
func (*RandomConnectionManager) Remove ¶
func (m *RandomConnectionManager) Remove(conn *grpc.ClientConn)
Remove removes a connection from the manager.
func (*RandomConnectionManager) Select ¶
func (m *RandomConnectionManager) Select() (*grpc.ClientConn, error)