i9k

package
v0.0.0-...-3cf5113 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 3 megabytes
	MaxChunkSize = 3e+6
)

Variables

This section is empty.

Functions

func GenerateTLSKeyPair

func GenerateTLSKeyPair(at string) error

func GetCertFileFingerprint

func GetCertFileFingerprint(at string) (string, error)

func GetCertFingerprint

func GetCertFingerprint(cert *x509.Certificate) (string, error)

func GetPeerFingerprint

func GetPeerFingerprint(ctx context.Context) (string, error)

func RegisterStorageServer

func RegisterStorageServer(s *grpc.Server, srv StorageServer)

Types

type DirectoryEnt

type DirectoryEnt struct {
	Path                 string   `protobuf:"bytes,1,opt,name=Path,proto3" json:"Path,omitempty"`
	Size                 int64    `protobuf:"varint,2,opt,name=Size,proto3" json:"Size,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DirectoryEnt) Descriptor

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

func (*DirectoryEnt) GetPath

func (m *DirectoryEnt) GetPath() string

func (*DirectoryEnt) GetSize

func (m *DirectoryEnt) GetSize() int64

func (*DirectoryEnt) ProtoMessage

func (*DirectoryEnt) ProtoMessage()

func (*DirectoryEnt) Reset

func (m *DirectoryEnt) Reset()

func (*DirectoryEnt) String

func (m *DirectoryEnt) String() string

func (*DirectoryEnt) XXX_DiscardUnknown

func (m *DirectoryEnt) XXX_DiscardUnknown()

func (*DirectoryEnt) XXX_Marshal

func (m *DirectoryEnt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DirectoryEnt) XXX_Merge

func (m *DirectoryEnt) XXX_Merge(src proto.Message)

func (*DirectoryEnt) XXX_Size

func (m *DirectoryEnt) XXX_Size() int

func (*DirectoryEnt) XXX_Unmarshal

func (m *DirectoryEnt) XXX_Unmarshal(b []byte) error

type DirectoryList

type DirectoryList struct {
	Results              []*DirectoryEnt `protobuf:"bytes,1,rep,name=Results,proto3" json:"Results,omitempty"`
	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
	XXX_unrecognized     []byte          `json:"-"`
	XXX_sizecache        int32           `json:"-"`
}

func (*DirectoryList) Descriptor

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

func (*DirectoryList) GetResults

func (m *DirectoryList) GetResults() []*DirectoryEnt

func (*DirectoryList) ProtoMessage

func (*DirectoryList) ProtoMessage()

func (*DirectoryList) Reset

func (m *DirectoryList) Reset()

func (*DirectoryList) String

func (m *DirectoryList) String() string

func (*DirectoryList) XXX_DiscardUnknown

func (m *DirectoryList) XXX_DiscardUnknown()

func (*DirectoryList) XXX_Marshal

func (m *DirectoryList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DirectoryList) XXX_Merge

func (m *DirectoryList) XXX_Merge(src proto.Message)

func (*DirectoryList) XXX_Size

func (m *DirectoryList) XXX_Size() int

func (*DirectoryList) XXX_Unmarshal

func (m *DirectoryList) XXX_Unmarshal(b []byte) error

type Empty

type Empty struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Empty) Descriptor

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

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) Reset

func (m *Empty) Reset()

func (*Empty) String

func (m *Empty) String() string

func (*Empty) XXX_DiscardUnknown

func (m *Empty) XXX_DiscardUnknown()

func (*Empty) XXX_Marshal

func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Empty) XXX_Merge

func (m *Empty) XXX_Merge(src proto.Message)

func (*Empty) XXX_Size

func (m *Empty) XXX_Size() int

func (*Empty) XXX_Unmarshal

func (m *Empty) XXX_Unmarshal(b []byte) error

type File

type File struct {
	Path string
	*os.File
}

type FileStorageClient

type FileStorageClient struct {
	StorageClient
}

func (*FileStorageClient) Overwrite

func (fsc *FileStorageClient) Overwrite(path string, size int64, reader io.Reader) error

type FileStorageServer

type FileStorageServer struct {
	Base        etc.Path
	Fingerprint string
}

FileStorageServer can be embedded to have forward compatible implementations.

func (*FileStorageServer) ListDirectory

func (fss *FileStorageServer) ListDirectory(ctx context.Context, req *Empty) (*DirectoryList, error)

func (*FileStorageServer) ReadAt

func (fss *FileStorageServer) ReadAt(ctx context.Context, req *ReadAtRequest) (*ReadChunk, error)

func (*FileStorageServer) Stat

func (*FileStorageServer) WriteAll

func (fss *FileStorageServer) WriteAll(srv Storage_WriteAllServer) error

type ReadAtRequest

type ReadAtRequest struct {
	Path                 string   `protobuf:"bytes,1,opt,name=Path,proto3" json:"Path,omitempty"`
	StartOffset          uint64   `protobuf:"varint,2,opt,name=StartOffset,proto3" json:"StartOffset,omitempty"`
	Size                 uint64   `protobuf:"varint,3,opt,name=Size,proto3" json:"Size,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ReadAtRequest) Descriptor

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

func (*ReadAtRequest) GetPath

func (m *ReadAtRequest) GetPath() string

func (*ReadAtRequest) GetSize

func (m *ReadAtRequest) GetSize() uint64

func (*ReadAtRequest) GetStartOffset

func (m *ReadAtRequest) GetStartOffset() uint64

func (*ReadAtRequest) ProtoMessage

func (*ReadAtRequest) ProtoMessage()

func (*ReadAtRequest) Reset

func (m *ReadAtRequest) Reset()

func (*ReadAtRequest) String

func (m *ReadAtRequest) String() string

func (*ReadAtRequest) XXX_DiscardUnknown

func (m *ReadAtRequest) XXX_DiscardUnknown()

func (*ReadAtRequest) XXX_Marshal

func (m *ReadAtRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ReadAtRequest) XXX_Merge

func (m *ReadAtRequest) XXX_Merge(src proto.Message)

func (*ReadAtRequest) XXX_Size

func (m *ReadAtRequest) XXX_Size() int

func (*ReadAtRequest) XXX_Unmarshal

func (m *ReadAtRequest) XXX_Unmarshal(b []byte) error

type ReadChunk

type ReadChunk struct {
	Data                 []byte   `protobuf:"bytes,1,opt,name=Data,proto3" json:"Data,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ReadChunk) Descriptor

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

func (*ReadChunk) GetData

func (m *ReadChunk) GetData() []byte

func (*ReadChunk) ProtoMessage

func (*ReadChunk) ProtoMessage()

func (*ReadChunk) Reset

func (m *ReadChunk) Reset()

func (*ReadChunk) String

func (m *ReadChunk) String() string

func (*ReadChunk) XXX_DiscardUnknown

func (m *ReadChunk) XXX_DiscardUnknown()

func (*ReadChunk) XXX_Marshal

func (m *ReadChunk) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ReadChunk) XXX_Merge

func (m *ReadChunk) XXX_Merge(src proto.Message)

func (*ReadChunk) XXX_Size

func (m *ReadChunk) XXX_Size() int

func (*ReadChunk) XXX_Unmarshal

func (m *ReadChunk) XXX_Unmarshal(b []byte) error

type StatRequest

type StatRequest struct {
	Path                 string   `protobuf:"bytes,1,opt,name=Path,proto3" json:"Path,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StatRequest) Descriptor

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

func (*StatRequest) GetPath

func (m *StatRequest) GetPath() string

func (*StatRequest) ProtoMessage

func (*StatRequest) ProtoMessage()

func (*StatRequest) Reset

func (m *StatRequest) Reset()

func (*StatRequest) String

func (m *StatRequest) String() string

func (*StatRequest) XXX_DiscardUnknown

func (m *StatRequest) XXX_DiscardUnknown()

func (*StatRequest) XXX_Marshal

func (m *StatRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StatRequest) XXX_Merge

func (m *StatRequest) XXX_Merge(src proto.Message)

func (*StatRequest) XXX_Size

func (m *StatRequest) XXX_Size() int

func (*StatRequest) XXX_Unmarshal

func (m *StatRequest) XXX_Unmarshal(b []byte) error

type StatResponse

type StatResponse struct {
	FileName             string               `protobuf:"bytes,1,opt,name=FileName,proto3" json:"FileName,omitempty"`
	FileSize             int64                `protobuf:"varint,2,opt,name=FileSize,proto3" json:"FileSize,omitempty"`
	FileMode             uint32               `protobuf:"varint,3,opt,name=FileMode,proto3" json:"FileMode,omitempty"`
	FileModTime          *timestamp.Timestamp `protobuf:"bytes,4,opt,name=FileModTime,proto3" json:"FileModTime,omitempty"`
	FileIsDirectory      bool                 `protobuf:"varint,5,opt,name=FileIsDirectory,proto3" json:"FileIsDirectory,omitempty"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
	XXX_unrecognized     []byte               `json:"-"`
	XXX_sizecache        int32                `json:"-"`
}

func (*StatResponse) Descriptor

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

func (*StatResponse) GetFileIsDirectory

func (m *StatResponse) GetFileIsDirectory() bool

func (*StatResponse) GetFileModTime

func (m *StatResponse) GetFileModTime() *timestamp.Timestamp

func (*StatResponse) GetFileMode

func (m *StatResponse) GetFileMode() uint32

func (*StatResponse) GetFileName

func (m *StatResponse) GetFileName() string

func (*StatResponse) GetFileSize

func (m *StatResponse) GetFileSize() int64

func (*StatResponse) IsDir

func (s *StatResponse) IsDir() bool

func (*StatResponse) ModTime

func (s *StatResponse) ModTime() time.Time

func (*StatResponse) Mode

func (s *StatResponse) Mode() os.FileMode

func (*StatResponse) Name

func (s *StatResponse) Name() string

func (*StatResponse) ProtoMessage

func (*StatResponse) ProtoMessage()

func (*StatResponse) Reset

func (m *StatResponse) Reset()

func (*StatResponse) Size

func (s *StatResponse) Size() int64

func (*StatResponse) String

func (m *StatResponse) String() string

func (*StatResponse) Sys

func (s *StatResponse) Sys() interface{}

func (*StatResponse) XXX_DiscardUnknown

func (m *StatResponse) XXX_DiscardUnknown()

func (*StatResponse) XXX_Marshal

func (m *StatResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StatResponse) XXX_Merge

func (m *StatResponse) XXX_Merge(src proto.Message)

func (*StatResponse) XXX_Size

func (m *StatResponse) XXX_Size() int

func (*StatResponse) XXX_Unmarshal

func (m *StatResponse) XXX_Unmarshal(b []byte) error

type StorageClient

type StorageClient interface {
	Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error)
	WriteAll(ctx context.Context, opts ...grpc.CallOption) (Storage_WriteAllClient, error)
	ReadAt(ctx context.Context, in *ReadAtRequest, opts ...grpc.CallOption) (*ReadChunk, error)
	ListDirectory(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*DirectoryList, error)
}

StorageClient is the client API for Storage service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewStorageClient

func NewStorageClient(cc *grpc.ClientConn) StorageClient

type StorageServer

type StorageServer interface {
	Stat(context.Context, *StatRequest) (*StatResponse, error)
	WriteAll(Storage_WriteAllServer) error
	ReadAt(context.Context, *ReadAtRequest) (*ReadChunk, error)
	ListDirectory(context.Context, *Empty) (*DirectoryList, error)
}

StorageServer is the server API for Storage service.

type Storage_WriteAllClient

type Storage_WriteAllClient interface {
	Send(*WritePiece) error
	CloseAndRecv() (*Empty, error)
	grpc.ClientStream
}

type Storage_WriteAllServer

type Storage_WriteAllServer interface {
	SendAndClose(*Empty) error
	Recv() (*WritePiece, error)
	grpc.ServerStream
}

type UnimplementedStorageServer

type UnimplementedStorageServer struct {
}

UnimplementedStorageServer can be embedded to have forward compatible implementations.

func (*UnimplementedStorageServer) ListDirectory

func (*UnimplementedStorageServer) ListDirectory(ctx context.Context, req *Empty) (*DirectoryList, error)

func (*UnimplementedStorageServer) ReadAt

func (*UnimplementedStorageServer) Stat

func (*UnimplementedStorageServer) WriteAll

type WritePiece

type WritePiece struct {
	// Types that are valid to be assigned to PieceContent:
	//	*WritePiece_FileName
	//	*WritePiece_Data
	PieceContent         isWritePiece_PieceContent `protobuf_oneof:"PieceContent"`
	XXX_NoUnkeyedLiteral struct{}                  `json:"-"`
	XXX_unrecognized     []byte                    `json:"-"`
	XXX_sizecache        int32                     `json:"-"`
}

func (*WritePiece) Descriptor

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

func (*WritePiece) GetData

func (m *WritePiece) GetData() []byte

func (*WritePiece) GetFileName

func (m *WritePiece) GetFileName() string

func (*WritePiece) GetPieceContent

func (m *WritePiece) GetPieceContent() isWritePiece_PieceContent

func (*WritePiece) ProtoMessage

func (*WritePiece) ProtoMessage()

func (*WritePiece) Reset

func (m *WritePiece) Reset()

func (*WritePiece) String

func (m *WritePiece) String() string

func (*WritePiece) XXX_DiscardUnknown

func (m *WritePiece) XXX_DiscardUnknown()

func (*WritePiece) XXX_Marshal

func (m *WritePiece) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WritePiece) XXX_Merge

func (m *WritePiece) XXX_Merge(src proto.Message)

func (*WritePiece) XXX_OneofWrappers

func (*WritePiece) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*WritePiece) XXX_Size

func (m *WritePiece) XXX_Size() int

func (*WritePiece) XXX_Unmarshal

func (m *WritePiece) XXX_Unmarshal(b []byte) error

type WritePiece_Data

type WritePiece_Data struct {
	Data []byte `protobuf:"bytes,2,opt,name=Data,proto3,oneof"`
}

type WritePiece_FileName

type WritePiece_FileName struct {
	FileName string `protobuf:"bytes,1,opt,name=FileName,proto3,oneof"`
}

Jump to

Keyboard shortcuts

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