blockv1

package
v0.0.0-...-e27afb6 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package blockv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var BlockAPI_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "aetherfs.block.v1.BlockAPI",
	HandlerType: (*BlockAPIServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Lookup",
			Handler:    _BlockAPI_Lookup_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Download",
			Handler:       _BlockAPI_Download_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Upload",
			Handler:       _BlockAPI_Upload_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "aetherfs/block/v1/api.proto",
}

BlockAPI_ServiceDesc is the grpc.ServiceDesc for BlockAPI service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_aetherfs_block_v1_api_proto protoreflect.FileDescriptor

Functions

func RegisterBlockAPIHandler

func RegisterBlockAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterBlockAPIHandler registers the http handlers for service BlockAPI to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterBlockAPIHandlerClient

func RegisterBlockAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BlockAPIClient) error

RegisterBlockAPIHandlerClient registers the http handlers for service BlockAPI to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BlockAPIClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BlockAPIClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "BlockAPIClient" to call the correct interceptors.

func RegisterBlockAPIHandlerFromEndpoint

func RegisterBlockAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterBlockAPIHandlerFromEndpoint is same as RegisterBlockAPIHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterBlockAPIHandlerServer

func RegisterBlockAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BlockAPIServer) error

RegisterBlockAPIHandlerServer registers the http handlers for service BlockAPI to "mux". UnaryRPC :call BlockAPIServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterBlockAPIHandlerFromEndpoint instead.

func RegisterBlockAPIServer

func RegisterBlockAPIServer(s grpc.ServiceRegistrar, srv BlockAPIServer)

Types

type BlockAPIClient

type BlockAPIClient interface {
	Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error)
	Download(ctx context.Context, in *DownloadRequest, opts ...grpc.CallOption) (BlockAPI_DownloadClient, error)
	Upload(ctx context.Context, opts ...grpc.CallOption) (BlockAPI_UploadClient, error)
}

BlockAPIClient is the client API for BlockAPI service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewBlockAPIClient

func NewBlockAPIClient(cc grpc.ClientConnInterface) BlockAPIClient

type BlockAPIServer

type BlockAPIServer interface {
	Lookup(context.Context, *LookupRequest) (*LookupResponse, error)
	Download(*DownloadRequest, BlockAPI_DownloadServer) error
	Upload(BlockAPI_UploadServer) error
	// contains filtered or unexported methods
}

BlockAPIServer is the server API for BlockAPI service. All implementations must embed UnimplementedBlockAPIServer for forward compatibility

type BlockAPI_DownloadClient

type BlockAPI_DownloadClient interface {
	Recv() (*DownloadResponse, error)
	grpc.ClientStream
}

type BlockAPI_DownloadServer

type BlockAPI_DownloadServer interface {
	Send(*DownloadResponse) error
	grpc.ServerStream
}

type BlockAPI_UploadClient

type BlockAPI_UploadClient interface {
	Send(*UploadRequest) error
	CloseAndRecv() (*UploadResponse, error)
	grpc.ClientStream
}

type BlockAPI_UploadServer

type BlockAPI_UploadServer interface {
	SendAndClose(*UploadResponse) error
	Recv() (*UploadRequest, error)
	grpc.ServerStream
}

type DownloadRequest

type DownloadRequest struct {
	Signature string `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` // the id of the block to download
	Offset    int64  `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"`      // an offset within the block
	Size      int64  `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`          // the number of bytes to read from a block (0 will read the remainder of the block)
	// contains filtered or unexported fields
}

DownloadRequest is used to download parts of or entire blocks from our backend store. Blocks are cached amongst cluster peers in smaller pieces. DownloadRequests streams parts of a semi-large file from the server during a download. Blocks are cached amongst cluster peers, typically in smaller parts to have better cache performance.

func (*DownloadRequest) Descriptor deprecated

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

Deprecated: Use DownloadRequest.ProtoReflect.Descriptor instead.

func (*DownloadRequest) GetOffset

func (x *DownloadRequest) GetOffset() int64

func (*DownloadRequest) GetSignature

func (x *DownloadRequest) GetSignature() string

func (*DownloadRequest) GetSize

func (x *DownloadRequest) GetSize() int64

func (*DownloadRequest) ProtoMessage

func (*DownloadRequest) ProtoMessage()

func (*DownloadRequest) ProtoReflect

func (x *DownloadRequest) ProtoReflect() protoreflect.Message

func (*DownloadRequest) Reset

func (x *DownloadRequest) Reset()

func (*DownloadRequest) String

func (x *DownloadRequest) String() string

type DownloadResponse

type DownloadResponse struct {
	Part []byte `protobuf:"bytes,1,opt,name=part,proto3" json:"part,omitempty"` // a part of the block we're downloading
	// contains filtered or unexported fields
}

func (*DownloadResponse) Descriptor deprecated

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

Deprecated: Use DownloadResponse.ProtoReflect.Descriptor instead.

func (*DownloadResponse) GetPart

func (x *DownloadResponse) GetPart() []byte

func (*DownloadResponse) ProtoMessage

func (*DownloadResponse) ProtoMessage()

func (*DownloadResponse) ProtoReflect

func (x *DownloadResponse) ProtoReflect() protoreflect.Message

func (*DownloadResponse) Reset

func (x *DownloadResponse) Reset()

func (*DownloadResponse) String

func (x *DownloadResponse) String() string

type LookupRequest

type LookupRequest struct {
	Signature string `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

LookupRequest is used to quickly check to see if a block exists for the given signature. This is used to short-circuit uploads for blocks that already exist and do not need to be uploaded.

func (*LookupRequest) Descriptor deprecated

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

Deprecated: Use LookupRequest.ProtoReflect.Descriptor instead.

func (*LookupRequest) GetSignature

func (x *LookupRequest) GetSignature() string

func (*LookupRequest) ProtoMessage

func (*LookupRequest) ProtoMessage()

func (*LookupRequest) ProtoReflect

func (x *LookupRequest) ProtoReflect() protoreflect.Message

func (*LookupRequest) Reset

func (x *LookupRequest) Reset()

func (*LookupRequest) String

func (x *LookupRequest) String() string

type LookupResponse

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

func (*LookupResponse) Descriptor deprecated

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

Deprecated: Use LookupResponse.ProtoReflect.Descriptor instead.

func (*LookupResponse) ProtoMessage

func (*LookupResponse) ProtoMessage()

func (*LookupResponse) ProtoReflect

func (x *LookupResponse) ProtoReflect() protoreflect.Message

func (*LookupResponse) Reset

func (x *LookupResponse) Reset()

func (*LookupResponse) String

func (x *LookupResponse) String() string

type UnimplementedBlockAPIServer

type UnimplementedBlockAPIServer struct {
}

UnimplementedBlockAPIServer must be embedded to have forward compatible implementations.

func (UnimplementedBlockAPIServer) Download

func (UnimplementedBlockAPIServer) Lookup

func (UnimplementedBlockAPIServer) Upload

type UnsafeBlockAPIServer

type UnsafeBlockAPIServer interface {
	// contains filtered or unexported methods
}

UnsafeBlockAPIServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to BlockAPIServer will result in compilation errors.

type UploadRequest

type UploadRequest struct {
	Part []byte `protobuf:"bytes,1,opt,name=part,proto3" json:"part,omitempty"` // a part of the block we're uploading
	// contains filtered or unexported fields
}

UploadRequest streams parts of a semi-large file to the server during an upload.

func (*UploadRequest) Descriptor deprecated

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

Deprecated: Use UploadRequest.ProtoReflect.Descriptor instead.

func (*UploadRequest) GetPart

func (x *UploadRequest) GetPart() []byte

func (*UploadRequest) ProtoMessage

func (*UploadRequest) ProtoMessage()

func (*UploadRequest) ProtoReflect

func (x *UploadRequest) ProtoReflect() protoreflect.Message

func (*UploadRequest) Reset

func (x *UploadRequest) Reset()

func (*UploadRequest) String

func (x *UploadRequest) String() string

type UploadResponse

type UploadResponse struct {
	Signature string `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` // the id of the block that was uploaded
	// contains filtered or unexported fields
}

func (*UploadResponse) Descriptor deprecated

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

Deprecated: Use UploadResponse.ProtoReflect.Descriptor instead.

func (*UploadResponse) GetSignature

func (x *UploadResponse) GetSignature() string

func (*UploadResponse) ProtoMessage

func (*UploadResponse) ProtoMessage()

func (*UploadResponse) ProtoReflect

func (x *UploadResponse) ProtoReflect() protoreflect.Message

func (*UploadResponse) Reset

func (x *UploadResponse) Reset()

func (*UploadResponse) String

func (x *UploadResponse) String() string

Jump to

Keyboard shortcuts

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