Documentation
¶
Index ¶
- Variables
- type CacheOption
- type GetRequest
- func (*GetRequest) Descriptor() ([]byte, []int)
- func (m *GetRequest) GetAddress() []byte
- func (m *GetRequest) GetCache() CacheOption
- func (m *GetRequest) Marshal() (dAtA []byte, err error)
- func (m *GetRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GetRequest) ProtoMessage()
- func (m *GetRequest) Reset()
- func (m *GetRequest) Size() (n int)
- func (m *GetRequest) String() string
- func (m *GetRequest) Unmarshal(dAtA []byte) error
- func (m *GetRequest) XXX_DiscardUnknown()
- func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GetRequest) XXX_Merge(src proto.Message)
- func (m *GetRequest) XXX_Size() int
- func (m *GetRequest) XXX_Unmarshal(b []byte) error
- type GetResponse
- func (*GetResponse) Descriptor() ([]byte, []int)
- func (m *GetResponse) GetAddress() []byte
- func (m *GetResponse) GetData() []byte
- func (m *GetResponse) GetError() string
- func (m *GetResponse) GetStatus() Status
- func (m *GetResponse) Marshal() (dAtA []byte, err error)
- func (m *GetResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GetResponse) ProtoMessage()
- func (m *GetResponse) Reset()
- func (m *GetResponse) Size() (n int)
- func (m *GetResponse) String() string
- func (m *GetResponse) Unmarshal(dAtA []byte) error
- func (m *GetResponse) XXX_DiscardUnknown()
- func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GetResponse) XXX_Merge(src proto.Message)
- func (m *GetResponse) XXX_Size() int
- func (m *GetResponse) XXX_Unmarshal(b []byte) error
- type PutRequest
- func (*PutRequest) Descriptor() ([]byte, []int)
- func (m *PutRequest) GetAddress() []byte
- func (m *PutRequest) GetBatchId() []byte
- func (m *PutRequest) GetData() []byte
- func (m *PutRequest) GetStamp() []byte
- func (m *PutRequest) Marshal() (dAtA []byte, err error)
- func (m *PutRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PutRequest) ProtoMessage()
- func (m *PutRequest) Reset()
- func (m *PutRequest) Size() (n int)
- func (m *PutRequest) String() string
- func (m *PutRequest) Unmarshal(dAtA []byte) error
- func (m *PutRequest) XXX_DiscardUnknown()
- func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PutRequest) XXX_Merge(src proto.Message)
- func (m *PutRequest) XXX_Size() int
- func (m *PutRequest) XXX_Unmarshal(b []byte) error
- type PutResponse
- func (*PutResponse) Descriptor() ([]byte, []int)
- func (m *PutResponse) GetAddress() []byte
- func (m *PutResponse) GetError() string
- func (m *PutResponse) GetStatus() Status
- func (m *PutResponse) Marshal() (dAtA []byte, err error)
- func (m *PutResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PutResponse) ProtoMessage()
- func (m *PutResponse) Reset()
- func (m *PutResponse) Size() (n int)
- func (m *PutResponse) String() string
- func (m *PutResponse) Unmarshal(dAtA []byte) error
- func (m *PutResponse) XXX_DiscardUnknown()
- func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PutResponse) XXX_Merge(src proto.Message)
- func (m *PutResponse) XXX_Size() int
- func (m *PutResponse) XXX_Unmarshal(b []byte) error
- type Request
- func (*Request) Descriptor() ([]byte, []int)
- func (m *Request) GetBody() isRequest_Body
- func (m *Request) GetGet() *GetRequest
- func (m *Request) GetPut() *PutRequest
- func (m *Request) Marshal() (dAtA []byte, err error)
- func (m *Request) MarshalTo(dAtA []byte) (int, error)
- func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Request) ProtoMessage()
- func (m *Request) Reset()
- func (m *Request) Size() (n int)
- func (m *Request) String() string
- func (m *Request) Unmarshal(dAtA []byte) error
- func (m *Request) XXX_DiscardUnknown()
- func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Request) XXX_Merge(src proto.Message)
- func (*Request) XXX_OneofWrappers() []interface{}
- func (m *Request) XXX_Size() int
- func (m *Request) XXX_Unmarshal(b []byte) error
- type Request_Get
- type Request_Put
- type Response
- func (*Response) Descriptor() ([]byte, []int)
- func (m *Response) GetBody() isResponse_Body
- func (m *Response) GetGet() *GetResponse
- func (m *Response) GetPut() *PutResponse
- func (m *Response) Marshal() (dAtA []byte, err error)
- func (m *Response) MarshalTo(dAtA []byte) (int, error)
- func (m *Response) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Response) ProtoMessage()
- func (m *Response) Reset()
- func (m *Response) Size() (n int)
- func (m *Response) String() string
- func (m *Response) Unmarshal(dAtA []byte) error
- func (m *Response) XXX_DiscardUnknown()
- func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Response) XXX_Merge(src proto.Message)
- func (*Response) XXX_OneofWrappers() []interface{}
- func (m *Response) XXX_Size() int
- func (m *Response) XXX_Unmarshal(b []byte) error
- type Response_Get
- type Response_Put
- type Status
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthChunkstream = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowChunkstream = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupChunkstream = fmt.Errorf("proto: unexpected end of group") )
var CacheOption_name = map[int32]string{
0: "CACHE_DEFAULT",
1: "CACHE_DISABLE",
2: "CACHE_ENABLE",
}
var CacheOption_value = map[string]int32{
"CACHE_DEFAULT": 0,
"CACHE_DISABLE": 1,
"CACHE_ENABLE": 2,
}
var Status_name = map[int32]string{
0: "STATUS_UNSPECIFIED",
1: "STATUS_OK",
2: "STATUS_NOT_FOUND",
3: "STATUS_ERROR",
4: "STATUS_BAD_REQUEST",
5: "STATUS_BUSY",
6: "STATUS_UNAVAILABLE",
}
var Status_value = map[string]int32{
"STATUS_UNSPECIFIED": 0,
"STATUS_OK": 1,
"STATUS_NOT_FOUND": 2,
"STATUS_ERROR": 3,
"STATUS_BAD_REQUEST": 4,
"STATUS_BUSY": 5,
"STATUS_UNAVAILABLE": 6,
}
Functions ¶
This section is empty.
Types ¶
type CacheOption ¶
type CacheOption int32
CacheOption controls whether a retrieved chunk is cached locally.
const ( // CACHE_DEFAULT uses the connection's caching behaviour (Swarm-Cache). CacheOption_CACHE_DEFAULT CacheOption = 0 // CACHE_DISABLE skips caching the chunk in the local store. CacheOption_CACHE_DISABLE CacheOption = 1 // CACHE_ENABLE caches the chunk in the local store. CacheOption_CACHE_ENABLE CacheOption = 2 )
func (CacheOption) EnumDescriptor ¶
func (CacheOption) EnumDescriptor() ([]byte, []int)
func (CacheOption) String ¶
func (x CacheOption) String() string
type GetRequest ¶
type GetRequest struct {
// Address is the 32-byte chunk address (CAC or SOC).
Address []byte `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"`
// Cache optionally overrides the connection's caching behaviour.
Cache CacheOption `protobuf:"varint,2,opt,name=Cache,proto3,enum=chunkstream.CacheOption" json:"Cache,omitempty"`
}
GetRequest retrieves a chunk by its address.
func (*GetRequest) Descriptor ¶
func (*GetRequest) Descriptor() ([]byte, []int)
func (*GetRequest) GetAddress ¶
func (m *GetRequest) GetAddress() []byte
func (*GetRequest) GetCache ¶
func (m *GetRequest) GetCache() CacheOption
func (*GetRequest) Marshal ¶
func (m *GetRequest) Marshal() (dAtA []byte, err error)
func (*GetRequest) MarshalToSizedBuffer ¶
func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GetRequest) ProtoMessage ¶
func (*GetRequest) ProtoMessage()
func (*GetRequest) Reset ¶
func (m *GetRequest) Reset()
func (*GetRequest) Size ¶
func (m *GetRequest) Size() (n int)
func (*GetRequest) String ¶
func (m *GetRequest) String() string
func (*GetRequest) Unmarshal ¶
func (m *GetRequest) Unmarshal(dAtA []byte) error
func (*GetRequest) XXX_DiscardUnknown ¶
func (m *GetRequest) XXX_DiscardUnknown()
func (*GetRequest) XXX_Marshal ¶
func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GetRequest) XXX_Merge ¶
func (m *GetRequest) XXX_Merge(src proto.Message)
func (*GetRequest) XXX_Size ¶
func (m *GetRequest) XXX_Size() int
func (*GetRequest) XXX_Unmarshal ¶
func (m *GetRequest) XXX_Unmarshal(b []byte) error
type GetResponse ¶
type GetResponse struct {
// Address is the address from the GetRequest.
Address []byte `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"`
// Status is the outcome of the retrieval.
Status Status `protobuf:"varint,2,opt,name=Status,proto3,enum=chunkstream.Status" json:"Status,omitempty"`
// Data is the chunk when Status is STATUS_OK, as stored under Address.
// CAC: span (8 bytes) + payload (up to 4096 bytes).
// SOC: id (32 bytes) + signature (65 bytes) + span (8 bytes) + payload (up to 4096 bytes).
Data []byte `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"`
// Error is a sanitised description when Status is not STATUS_OK.
Error string `protobuf:"bytes,4,opt,name=Error,proto3" json:"Error,omitempty"`
}
GetResponse answers a GetRequest.
func (*GetResponse) Descriptor ¶
func (*GetResponse) Descriptor() ([]byte, []int)
func (*GetResponse) GetAddress ¶
func (m *GetResponse) GetAddress() []byte
func (*GetResponse) GetData ¶
func (m *GetResponse) GetData() []byte
func (*GetResponse) GetError ¶
func (m *GetResponse) GetError() string
func (*GetResponse) GetStatus ¶
func (m *GetResponse) GetStatus() Status
func (*GetResponse) Marshal ¶
func (m *GetResponse) Marshal() (dAtA []byte, err error)
func (*GetResponse) MarshalToSizedBuffer ¶
func (m *GetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GetResponse) ProtoMessage ¶
func (*GetResponse) ProtoMessage()
func (*GetResponse) Reset ¶
func (m *GetResponse) Reset()
func (*GetResponse) Size ¶
func (m *GetResponse) Size() (n int)
func (*GetResponse) String ¶
func (m *GetResponse) String() string
func (*GetResponse) Unmarshal ¶
func (m *GetResponse) Unmarshal(dAtA []byte) error
func (*GetResponse) XXX_DiscardUnknown ¶
func (m *GetResponse) XXX_DiscardUnknown()
func (*GetResponse) XXX_Marshal ¶
func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GetResponse) XXX_Merge ¶
func (m *GetResponse) XXX_Merge(src proto.Message)
func (*GetResponse) XXX_Size ¶
func (m *GetResponse) XXX_Size() int
func (*GetResponse) XXX_Unmarshal ¶
func (m *GetResponse) XXX_Unmarshal(b []byte) error
type PutRequest ¶
type PutRequest struct {
// Address is the 32-byte address of the chunk. It must match the address the
// node computes from Data, and it settles whether Data is a CAC or a SOC:
// only one reading of the data can produce the address.
Address []byte `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"`
// Data is the serialised chunk.
// CAC: span (8 bytes) + payload (up to 4096 bytes).
// SOC: id (32 bytes) + signature (65 bytes) + span (8 bytes) + payload (up to 4096 bytes).
Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"`
// Stamp is a serialised pre-signed postage stamp. When set, it is used as is
// and BatchId is ignored. When the connection has a Swarm-Postage-Batch-Id, a
// stamp from a different batch is rejected.
Stamp []byte `protobuf:"bytes,3,opt,name=Stamp,proto3" json:"Stamp,omitempty"`
// BatchId has the node stamp the chunk with this 32-byte postage batch. When
// empty, the connection's Swarm-Postage-Batch-Id is used. When the connection
// has a Swarm-Postage-Batch-Id, a different BatchId is rejected.
BatchId []byte `protobuf:"bytes,4,opt,name=BatchId,proto3" json:"BatchId,omitempty"`
}
PutRequest stores a chunk and pushes it to the network. Uploads are always direct: STATUS_OK means the chunk was pushed to its neighbourhood.
func (*PutRequest) Descriptor ¶
func (*PutRequest) Descriptor() ([]byte, []int)
func (*PutRequest) GetAddress ¶
func (m *PutRequest) GetAddress() []byte
func (*PutRequest) GetBatchId ¶
func (m *PutRequest) GetBatchId() []byte
func (*PutRequest) GetData ¶
func (m *PutRequest) GetData() []byte
func (*PutRequest) GetStamp ¶
func (m *PutRequest) GetStamp() []byte
func (*PutRequest) Marshal ¶
func (m *PutRequest) Marshal() (dAtA []byte, err error)
func (*PutRequest) MarshalToSizedBuffer ¶
func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PutRequest) ProtoMessage ¶
func (*PutRequest) ProtoMessage()
func (*PutRequest) Reset ¶
func (m *PutRequest) Reset()
func (*PutRequest) Size ¶
func (m *PutRequest) Size() (n int)
func (*PutRequest) String ¶
func (m *PutRequest) String() string
func (*PutRequest) Unmarshal ¶
func (m *PutRequest) Unmarshal(dAtA []byte) error
func (*PutRequest) XXX_DiscardUnknown ¶
func (m *PutRequest) XXX_DiscardUnknown()
func (*PutRequest) XXX_Marshal ¶
func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PutRequest) XXX_Merge ¶
func (m *PutRequest) XXX_Merge(src proto.Message)
func (*PutRequest) XXX_Size ¶
func (m *PutRequest) XXX_Size() int
func (*PutRequest) XXX_Unmarshal ¶
func (m *PutRequest) XXX_Unmarshal(b []byte) error
type PutResponse ¶
type PutResponse struct {
// Address is the address from the PutRequest.
Address []byte `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"`
// Status is the outcome of the upload.
Status Status `protobuf:"varint,2,opt,name=Status,proto3,enum=chunkstream.Status" json:"Status,omitempty"`
// Error is a sanitised description when Status is not STATUS_OK.
Error string `protobuf:"bytes,3,opt,name=Error,proto3" json:"Error,omitempty"`
}
PutResponse answers a PutRequest.
func (*PutResponse) Descriptor ¶
func (*PutResponse) Descriptor() ([]byte, []int)
func (*PutResponse) GetAddress ¶
func (m *PutResponse) GetAddress() []byte
func (*PutResponse) GetError ¶
func (m *PutResponse) GetError() string
func (*PutResponse) GetStatus ¶
func (m *PutResponse) GetStatus() Status
func (*PutResponse) Marshal ¶
func (m *PutResponse) Marshal() (dAtA []byte, err error)
func (*PutResponse) MarshalToSizedBuffer ¶
func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PutResponse) ProtoMessage ¶
func (*PutResponse) ProtoMessage()
func (*PutResponse) Reset ¶
func (m *PutResponse) Reset()
func (*PutResponse) Size ¶
func (m *PutResponse) Size() (n int)
func (*PutResponse) String ¶
func (m *PutResponse) String() string
func (*PutResponse) Unmarshal ¶
func (m *PutResponse) Unmarshal(dAtA []byte) error
func (*PutResponse) XXX_DiscardUnknown ¶
func (m *PutResponse) XXX_DiscardUnknown()
func (*PutResponse) XXX_Marshal ¶
func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PutResponse) XXX_Merge ¶
func (m *PutResponse) XXX_Merge(src proto.Message)
func (*PutResponse) XXX_Size ¶
func (m *PutResponse) XXX_Size() int
func (*PutResponse) XXX_Unmarshal ¶
func (m *PutResponse) XXX_Unmarshal(b []byte) error
type Request ¶
type Request struct {
// Types that are valid to be assigned to Body:
//
// *Request_Get
// *Request_Put
Body isRequest_Body `protobuf_oneof:"body"`
}
Request is sent by a client to either download (Get) or upload (Put) a chunk.
Requests carry no identifier of their own: the chunk address is the key. The response to a request carries the same address, and its type (GetResponse or PutResponse) tells a download reply from an upload reply for the same chunk. A client must therefore not have two requests of the same type for the same address in flight on one connection.
func (*Request) Descriptor ¶
func (*Request) GetGet ¶
func (m *Request) GetGet() *GetRequest
func (*Request) GetPut ¶
func (m *Request) GetPut() *PutRequest
func (*Request) MarshalToSizedBuffer ¶
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) XXX_DiscardUnknown ¶
func (m *Request) XXX_DiscardUnknown()
func (*Request) XXX_Marshal ¶
func (*Request) XXX_OneofWrappers ¶
func (*Request) XXX_OneofWrappers() []interface{}
XXX_OneofWrappers is for the internal use of the proto package.
func (*Request) XXX_Unmarshal ¶
type Request_Get ¶
type Request_Get struct {
Get *GetRequest `protobuf:"bytes,1,opt,name=Get,proto3,oneof" json:"Get,omitempty"`
}
func (*Request_Get) MarshalToSizedBuffer ¶
func (m *Request_Get) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*Request_Get) Size ¶
func (m *Request_Get) Size() (n int)
type Request_Put ¶
type Request_Put struct {
Put *PutRequest `protobuf:"bytes,2,opt,name=Put,proto3,oneof" json:"Put,omitempty"`
}
func (*Request_Put) MarshalToSizedBuffer ¶
func (m *Request_Put) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*Request_Put) Size ¶
func (m *Request_Put) Size() (n int)
type Response ¶
type Response struct {
// Types that are valid to be assigned to Body:
//
// *Response_Get
// *Response_Put
Body isResponse_Body `protobuf_oneof:"body"`
}
Response is sent by the node in reply to each Request, with the same body type.
func (*Response) Descriptor ¶
func (*Response) GetGet ¶
func (m *Response) GetGet() *GetResponse
func (*Response) GetPut ¶
func (m *Response) GetPut() *PutResponse
func (*Response) MarshalToSizedBuffer ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) XXX_DiscardUnknown ¶
func (m *Response) XXX_DiscardUnknown()
func (*Response) XXX_Marshal ¶
func (*Response) XXX_OneofWrappers ¶
func (*Response) XXX_OneofWrappers() []interface{}
XXX_OneofWrappers is for the internal use of the proto package.
func (*Response) XXX_Unmarshal ¶
type Response_Get ¶
type Response_Get struct {
Get *GetResponse `protobuf:"bytes,1,opt,name=Get,proto3,oneof" json:"Get,omitempty"`
}
func (*Response_Get) MarshalToSizedBuffer ¶
func (m *Response_Get) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*Response_Get) Size ¶
func (m *Response_Get) Size() (n int)
type Response_Put ¶
type Response_Put struct {
Put *PutResponse `protobuf:"bytes,2,opt,name=Put,proto3,oneof" json:"Put,omitempty"`
}
func (*Response_Put) MarshalToSizedBuffer ¶
func (m *Response_Put) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*Response_Put) Size ¶
func (m *Response_Put) Size() (n int)
type Status ¶
type Status int32
Status is the outcome of a request.
const ( // STATUS_UNSPECIFIED is the proto3 zero value; never sent by the node. Status_STATUS_UNSPECIFIED Status = 0 // STATUS_OK: the chunk was retrieved, or pushed to the network. Status_STATUS_OK Status = 1 // STATUS_NOT_FOUND: the node does not have the chunk and the peers it asked // did not return it; retrieval gives up after a fixed number of failed // requests. The chunk may still exist; retry later, a limited number of times. Status_STATUS_NOT_FOUND Status = 2 // STATUS_ERROR: an internal or storage failure. Status_STATUS_ERROR Status = 3 // STATUS_BAD_REQUEST: invalid client input, such as malformed data, an invalid // stamp or batch, or an address that does not match the chunk. Status_STATUS_BAD_REQUEST Status = 4 // STATUS_BUSY: the request queue is full; retry with backoff. Status_STATUS_BUSY Status = 5 // STATUS_UNAVAILABLE: the node ran out of peers to ask for the chunk, either // because none was usable or because every one was tried. The chunk may or // may not exist; retry later, a limited number of times. Status_STATUS_UNAVAILABLE Status = 6 )