file

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 10 Imported by: 11

Documentation

Index

Constants

View Source
const (
	File_Get_FullMethodName              = "/gnoi.file.File/Get"
	File_TransferToRemote_FullMethodName = "/gnoi.file.File/TransferToRemote"
	File_Put_FullMethodName              = "/gnoi.file.File/Put"
	File_Stat_FullMethodName             = "/gnoi.file.File/Stat"
	File_Remove_FullMethodName           = "/gnoi.file.File/Remove"
)

Variables

View Source
var File_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gnoi.file.File",
	HandlerType: (*FileServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "TransferToRemote",
			Handler:    _File_TransferToRemote_Handler,
		},
		{
			MethodName: "Stat",
			Handler:    _File_Stat_Handler,
		},
		{
			MethodName: "Remove",
			Handler:    _File_Remove_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Get",
			Handler:       _File_Get_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Put",
			Handler:       _File_Put_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "file/file.proto",
}

File_ServiceDesc is the grpc.ServiceDesc for File 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_file_file_proto protoreflect.FileDescriptor

Functions

func RegisterFileServer

func RegisterFileServer(s grpc.ServiceRegistrar, srv FileServer)

Types

type FileClient

type FileClient interface {
	// Get reads and streams the contents of a file from the target.
	// The file is streamed by sequential messages, each containing up to
	// 64KB of data. A final message is sent prior to closing the stream
	// that contains the hash of the data sent. An error is returned
	// if the file does not exist or there was an error reading the file.
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (File_GetClient, error)
	// TransferToRemote transfers the contents of a file from the target to a
	// specified remote location. The response contains the hash of the data
	// transferred. An error is returned if the file does not exist, the file
	// transfer fails, or if there was an error reading the file. This is a
	// blocking call until the file transfer is complete.
	TransferToRemote(ctx context.Context, in *TransferToRemoteRequest, opts ...grpc.CallOption) (*TransferToRemoteResponse, error)
	// Put streams data into a file on the target. The file is sent in
	// sequential messages, each message containing up to 64KB of data. A final
	// message must be sent that includes the hash of the data sent. An
	// error is returned if the location does not exist or there is an error
	// writing the data. If no checksum is received, the target must assume the
	// operation is incomplete and remove the partially transmitted file. The
	// target should initially write the file to a temporary location so a failure
	// does not destroy the original file.
	Put(ctx context.Context, opts ...grpc.CallOption) (File_PutClient, error)
	// Stat returns metadata about a file on the target. An error is returned
	// if the file does not exist of there is an error in accessing the metadata.
	Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error)
	// Remove removes the specified file from the target. An error is
	// returned if the file does not exist, is a directory, or the remove
	// operation encounters an error (e.g., permission denied).
	Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*RemoveResponse, error)
}

FileClient is the client API for File 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 NewFileClient

func NewFileClient(cc grpc.ClientConnInterface) FileClient

type FileServer

type FileServer interface {
	// Get reads and streams the contents of a file from the target.
	// The file is streamed by sequential messages, each containing up to
	// 64KB of data. A final message is sent prior to closing the stream
	// that contains the hash of the data sent. An error is returned
	// if the file does not exist or there was an error reading the file.
	Get(*GetRequest, File_GetServer) error
	// TransferToRemote transfers the contents of a file from the target to a
	// specified remote location. The response contains the hash of the data
	// transferred. An error is returned if the file does not exist, the file
	// transfer fails, or if there was an error reading the file. This is a
	// blocking call until the file transfer is complete.
	TransferToRemote(context.Context, *TransferToRemoteRequest) (*TransferToRemoteResponse, error)
	// Put streams data into a file on the target. The file is sent in
	// sequential messages, each message containing up to 64KB of data. A final
	// message must be sent that includes the hash of the data sent. An
	// error is returned if the location does not exist or there is an error
	// writing the data. If no checksum is received, the target must assume the
	// operation is incomplete and remove the partially transmitted file. The
	// target should initially write the file to a temporary location so a failure
	// does not destroy the original file.
	Put(File_PutServer) error
	// Stat returns metadata about a file on the target. An error is returned
	// if the file does not exist of there is an error in accessing the metadata.
	Stat(context.Context, *StatRequest) (*StatResponse, error)
	// Remove removes the specified file from the target. An error is
	// returned if the file does not exist, is a directory, or the remove
	// operation encounters an error (e.g., permission denied).
	Remove(context.Context, *RemoveRequest) (*RemoveResponse, error)
	// contains filtered or unexported methods
}

FileServer is the server API for File service. All implementations must embed UnimplementedFileServer for forward compatibility

type File_GetClient

type File_GetClient interface {
	Recv() (*GetResponse, error)
	grpc.ClientStream
}

type File_GetServer

type File_GetServer interface {
	Send(*GetResponse) error
	grpc.ServerStream
}

type File_PutClient

type File_PutClient interface {
	Send(*PutRequest) error
	CloseAndRecv() (*PutResponse, error)
	grpc.ClientStream
}

type File_PutServer

type File_PutServer interface {
	SendAndClose(*PutResponse) error
	Recv() (*PutRequest, error)
	grpc.ServerStream
}

type GetRequest

type GetRequest struct {
	RemoteFile string `protobuf:"bytes,1,opt,name=remote_file,json=remoteFile,proto3" json:"remote_file,omitempty"`
	// contains filtered or unexported fields
}

A GetRequest specifies the remote_file to be streamed back to the caller. The remote_file must be an absolute path to an existing file.

func (*GetRequest) Descriptor deprecated

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetRemoteFile

func (x *GetRequest) GetRemoteFile() string

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect

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

func (*GetRequest) Reset

func (x *GetRequest) Reset()

func (*GetRequest) String

func (x *GetRequest) String() string

type GetResponse

type GetResponse struct {

	// Types that are assignable to Response:
	//
	//	*GetResponse_Contents
	//	*GetResponse_Hash
	Response isGetResponse_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

A GetResponse either contains the next set of bytes read from the file or, as the last message, the hash of the data.

func (*GetResponse) Descriptor deprecated

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

Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.

func (*GetResponse) GetContents

func (x *GetResponse) GetContents() []byte

func (*GetResponse) GetHash

func (x *GetResponse) GetHash() *types.HashType

func (*GetResponse) GetResponse

func (m *GetResponse) GetResponse() isGetResponse_Response

func (*GetResponse) ProtoMessage

func (*GetResponse) ProtoMessage()

func (*GetResponse) ProtoReflect

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

func (*GetResponse) Reset

func (x *GetResponse) Reset()

func (*GetResponse) String

func (x *GetResponse) String() string

type GetResponse_Contents

type GetResponse_Contents struct {
	Contents []byte `protobuf:"bytes,1,opt,name=contents,proto3,oneof"`
}

type GetResponse_Hash

type GetResponse_Hash struct {
	Hash *types.HashType `protobuf:"bytes,2,opt,name=hash,proto3,oneof"` // hash of the file.
}

type PutRequest

type PutRequest struct {

	// Types that are assignable to Request:
	//
	//	*PutRequest_Open
	//	*PutRequest_Contents
	//	*PutRequest_Hash
	Request isPutRequest_Request `protobuf_oneof:"request"`
	// contains filtered or unexported fields
}

A PutRequest is used to send data to be written on a file on the target.

The initial message contains an Open message. The Open message contains information name of the file and the file's permisssions.

The remote_file must be an absolute path. If remote_file already exists on the target, it is overwritten, otherwise it is created. If the path to remote_file doesn't exist it will be created.

The contents to be written are streamed through multiple messages using the contents field. Each message may contain up to 64KB of data.

The final message of the RPC contains the hash of the file contents.

func (*PutRequest) Descriptor deprecated

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

Deprecated: Use PutRequest.ProtoReflect.Descriptor instead.

func (*PutRequest) GetContents

func (x *PutRequest) GetContents() []byte

func (*PutRequest) GetHash

func (x *PutRequest) GetHash() *types.HashType

func (*PutRequest) GetOpen

func (x *PutRequest) GetOpen() *PutRequest_Details

func (*PutRequest) GetRequest

func (m *PutRequest) GetRequest() isPutRequest_Request

func (*PutRequest) ProtoMessage

func (*PutRequest) ProtoMessage()

func (*PutRequest) ProtoReflect

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

func (*PutRequest) Reset

func (x *PutRequest) Reset()

func (*PutRequest) String

func (x *PutRequest) String() string

type PutRequest_Contents

type PutRequest_Contents struct {
	Contents []byte `protobuf:"bytes,2,opt,name=contents,proto3,oneof"`
}

type PutRequest_Details

type PutRequest_Details struct {
	RemoteFile string `protobuf:"bytes,1,opt,name=remote_file,json=remoteFile,proto3" json:"remote_file,omitempty"`
	// Permissions are represented as the octal format of standard UNIX
	// file permissions.
	// ex. 775: user read/write/execute, group read/write/execute,
	// global read/execute.
	Permissions uint32 `protobuf:"varint,2,opt,name=permissions,proto3" json:"permissions,omitempty"`
	// contains filtered or unexported fields
}

func (*PutRequest_Details) Descriptor deprecated

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

Deprecated: Use PutRequest_Details.ProtoReflect.Descriptor instead.

func (*PutRequest_Details) GetPermissions

func (x *PutRequest_Details) GetPermissions() uint32

func (*PutRequest_Details) GetRemoteFile

func (x *PutRequest_Details) GetRemoteFile() string

func (*PutRequest_Details) ProtoMessage

func (*PutRequest_Details) ProtoMessage()

func (*PutRequest_Details) ProtoReflect

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

func (*PutRequest_Details) Reset

func (x *PutRequest_Details) Reset()

func (*PutRequest_Details) String

func (x *PutRequest_Details) String() string

type PutRequest_Hash

type PutRequest_Hash struct {
	Hash *types.HashType `protobuf:"bytes,3,opt,name=hash,proto3,oneof"` // hash of the file.
}

type PutRequest_Open

type PutRequest_Open struct {
	Open *PutRequest_Details `protobuf:"bytes,1,opt,name=open,proto3,oneof"`
}

type PutResponse

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

func (*PutResponse) Descriptor deprecated

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

Deprecated: Use PutResponse.ProtoReflect.Descriptor instead.

func (*PutResponse) ProtoMessage

func (*PutResponse) ProtoMessage()

func (*PutResponse) ProtoReflect

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

func (*PutResponse) Reset

func (x *PutResponse) Reset()

func (*PutResponse) String

func (x *PutResponse) String() string

type RemoveRequest

type RemoveRequest struct {
	RemoteFile string `protobuf:"bytes,1,opt,name=remote_file,json=remoteFile,proto3" json:"remote_file,omitempty"`
	// contains filtered or unexported fields
}

A RemoveRequest specifies a file to be removed from the target.

func (*RemoveRequest) Descriptor deprecated

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

Deprecated: Use RemoveRequest.ProtoReflect.Descriptor instead.

func (*RemoveRequest) GetRemoteFile

func (x *RemoveRequest) GetRemoteFile() string

func (*RemoveRequest) ProtoMessage

func (*RemoveRequest) ProtoMessage()

func (*RemoveRequest) ProtoReflect

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

func (*RemoveRequest) Reset

func (x *RemoveRequest) Reset()

func (*RemoveRequest) String

func (x *RemoveRequest) String() string

type RemoveResponse

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

func (*RemoveResponse) Descriptor deprecated

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

Deprecated: Use RemoveResponse.ProtoReflect.Descriptor instead.

func (*RemoveResponse) ProtoMessage

func (*RemoveResponse) ProtoMessage()

func (*RemoveResponse) ProtoReflect

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

func (*RemoveResponse) Reset

func (x *RemoveResponse) Reset()

func (*RemoveResponse) String

func (x *RemoveResponse) String() string

type StatInfo

type StatInfo struct {
	Path         string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	LastModified uint64 `protobuf:"varint,2,opt,name=last_modified,json=lastModified,proto3" json:"last_modified,omitempty"` // Nanoseconds since epoch.
	// Permissions are represented as the octal format of standard UNIX
	// file permissions.
	// ex. 775: user read/write/execute, group read/write/execute,
	// global read/execute.
	// The value returned in this field should be the octal number. No base
	// conversion should be required to read the value. For example, 0755
	// should result in the permissions field holding the value 755, 4644
	// results in the permissions field being 4644, and so on.
	Permissions uint32 `protobuf:"varint,3,opt,name=permissions,proto3" json:"permissions,omitempty"`
	Size        uint64 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"`
	// Default file creation mask. Represented as the octal format of
	// standard UNIX mask.
	Umask uint32 `protobuf:"varint,5,opt,name=umask,proto3" json:"umask,omitempty"`
	// contains filtered or unexported fields
}

StatInfo provides a file system information about a particular path.

func (*StatInfo) Descriptor deprecated

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

Deprecated: Use StatInfo.ProtoReflect.Descriptor instead.

func (*StatInfo) GetLastModified

func (x *StatInfo) GetLastModified() uint64

func (*StatInfo) GetPath

func (x *StatInfo) GetPath() string

func (*StatInfo) GetPermissions

func (x *StatInfo) GetPermissions() uint32

func (*StatInfo) GetSize

func (x *StatInfo) GetSize() uint64

func (*StatInfo) GetUmask

func (x *StatInfo) GetUmask() uint32

func (*StatInfo) ProtoMessage

func (*StatInfo) ProtoMessage()

func (*StatInfo) ProtoReflect

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

func (*StatInfo) Reset

func (x *StatInfo) Reset()

func (*StatInfo) String

func (x *StatInfo) String() string

type StatRequest

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

StatRequest will list files at the provided path.

func (*StatRequest) Descriptor deprecated

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

Deprecated: Use StatRequest.ProtoReflect.Descriptor instead.

func (*StatRequest) GetPath

func (x *StatRequest) GetPath() string

func (*StatRequest) ProtoMessage

func (*StatRequest) ProtoMessage()

func (*StatRequest) ProtoReflect

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

func (*StatRequest) Reset

func (x *StatRequest) Reset()

func (*StatRequest) String

func (x *StatRequest) String() string

type StatResponse

type StatResponse struct {
	Stats []*StatInfo `protobuf:"bytes,1,rep,name=stats,proto3" json:"stats,omitempty"`
	// contains filtered or unexported fields
}

StatResponse contains list of stat info of the provided path.

func (*StatResponse) Descriptor deprecated

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

Deprecated: Use StatResponse.ProtoReflect.Descriptor instead.

func (*StatResponse) GetStats

func (x *StatResponse) GetStats() []*StatInfo

func (*StatResponse) ProtoMessage

func (*StatResponse) ProtoMessage()

func (*StatResponse) ProtoReflect

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

func (*StatResponse) Reset

func (x *StatResponse) Reset()

func (*StatResponse) String

func (x *StatResponse) String() string

type TransferToRemoteRequest

type TransferToRemoteRequest struct {
	LocalPath string `protobuf:"bytes,1,opt,name=local_path,json=localPath,proto3" json:"local_path,omitempty"`
	// Details to download the remote_file being requested to a remote location.
	RemoteDownload *common.RemoteDownload `protobuf:"bytes,2,opt,name=remote_download,json=remoteDownload,proto3" json:"remote_download,omitempty"`
	// contains filtered or unexported fields
}

A TransferToRemoteRequest specifies the local path to transfer to and the details on where to transfer the data from. The local_path must be an absolute path to the file.

func (*TransferToRemoteRequest) Descriptor deprecated

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

Deprecated: Use TransferToRemoteRequest.ProtoReflect.Descriptor instead.

func (*TransferToRemoteRequest) GetLocalPath

func (x *TransferToRemoteRequest) GetLocalPath() string

func (*TransferToRemoteRequest) GetRemoteDownload

func (x *TransferToRemoteRequest) GetRemoteDownload() *common.RemoteDownload

func (*TransferToRemoteRequest) ProtoMessage

func (*TransferToRemoteRequest) ProtoMessage()

func (*TransferToRemoteRequest) ProtoReflect

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

func (*TransferToRemoteRequest) Reset

func (x *TransferToRemoteRequest) Reset()

func (*TransferToRemoteRequest) String

func (x *TransferToRemoteRequest) String() string

type TransferToRemoteResponse

type TransferToRemoteResponse struct {
	Hash *types.HashType `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` // hash of the file.
	// contains filtered or unexported fields
}

A TransferToRemoteResponse contains the hash of the data transferred.

func (*TransferToRemoteResponse) Descriptor deprecated

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

Deprecated: Use TransferToRemoteResponse.ProtoReflect.Descriptor instead.

func (*TransferToRemoteResponse) GetHash

func (x *TransferToRemoteResponse) GetHash() *types.HashType

func (*TransferToRemoteResponse) ProtoMessage

func (*TransferToRemoteResponse) ProtoMessage()

func (*TransferToRemoteResponse) ProtoReflect

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

func (*TransferToRemoteResponse) Reset

func (x *TransferToRemoteResponse) Reset()

func (*TransferToRemoteResponse) String

func (x *TransferToRemoteResponse) String() string

type UnimplementedFileServer

type UnimplementedFileServer struct {
}

UnimplementedFileServer must be embedded to have forward compatible implementations.

func (UnimplementedFileServer) Get

func (UnimplementedFileServer) Put

func (UnimplementedFileServer) Remove

func (UnimplementedFileServer) Stat

type UnsafeFileServer

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

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

Jump to

Keyboard shortcuts

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