Documentation
¶
Index ¶
- Constants
- func MarshalWireError(err error) []byte
- func OpenVolume(ctx context.Context, n *Node, ep blobcache.Endpoint, id blobcache.OID) (volumes.Volume, error)
- func ParseWireError(x []byte) error
- type AbortReq
- type AbortResp
- type AccessFunc
- type AwaitReq
- type AwaitResp
- type BeginTxReq
- type BeginTxResp
- type CommitReq
- type CommitResp
- type DeleteEntryReq
- type DeleteEntryResp
- type DeleteReq
- type DeleteResp
- type DropReq
- type DropResp
- type ExistsReq
- type ExistsResp
- type GetEntryReq
- type GetEntryResp
- type GetReq
- type GetResp
- type HandleMapping
- type InspectHandleReq
- type InspectHandleResp
- type InspectVolumeReq
- type InspectVolumeResp
- type KeepAliveReq
- type KeepAliveResp
- type ListNamesReq
- type ListNamesResp
- type LoadReq
- type LoadResp
- type Message
- func (m *Message) Body() []byte
- func (m *Message) Header() MessageHeader
- func (m *Message) ReadFrom(r io.Reader) (int64, error)
- func (m *Message) SetBody(body []byte)
- func (m *Message) SetCode(code MessageType)
- func (m *Message) SetError(err error)
- func (m *Message) WriteTo(w io.Writer) (int64, error)
- type MessageHeader
- type MessageType
- type Node
- func (n *Node) Ask(ctx context.Context, remote blobcache.Endpoint, req Message, resp *Message) error
- func (n *Node) LocalAddr() netip.AddrPort
- func (n *Node) LocalEndpoint() blobcache.Endpoint
- func (n *Node) LocalID() blobcache.PeerID
- func (n *Node) Serve(ctx context.Context, srv Server) error
- func (n *Node) Tell(ctx context.Context, remote blobcache.Endpoint, req *Message) error
- type OpenAtReq
- type OpenAtResp
- type OpenReq
- type OpenResp
- type PutEntryReq
- type PutEntryResp
- type Server
- type Tx
- func (tx *Tx) Abort(ctx context.Context) error
- func (tx *Tx) Commit(ctx context.Context, root []byte) error
- func (tx *Tx) Delete(ctx context.Context, cid blobcache.CID) error
- func (tx *Tx) Exists(ctx context.Context, cid blobcache.CID) (bool, error)
- func (tx *Tx) Get(ctx context.Context, cid blobcache.CID, salt *blobcache.CID, buf []byte) (int, error)
- func (tx *Tx) Hash(salt *blobcache.CID, data []byte) blobcache.CID
- func (tx *Tx) Load(ctx context.Context, dst *[]byte) error
- func (tx *Tx) MaxSize() int
- func (tx *Tx) Post(ctx context.Context, salt *blobcache.CID, data []byte) (blobcache.CID, error)
- type Volume
- type WireError
Constants ¶
View Source
const HeaderLen = 1 + 4
Variables ¶
This section is empty.
Functions ¶
func MarshalWireError ¶
func OpenVolume ¶
func ParseWireError ¶
Types ¶
type AccessFunc ¶
AccessFun is called to get a service to access
type AwaitReq ¶
type AwaitReq struct {
Cond blobcache.Conditions `json:"cond"`
}
type BeginTxReq ¶
type BeginTxResp ¶
type BeginTxResp struct { // Tx is the handle for the transaction. Tx blobcache.Handle `json:"tx"` // VolumeInfo is the volume info for the transaction. VolumeInfo blobcache.VolumeInfo `json:"volume_info"` }
type CommitResp ¶
type CommitResp struct{}
type DeleteEntryReq ¶
type DeleteEntryResp ¶
type DeleteEntryResp struct{}
type DeleteResp ¶
type DeleteResp struct{}
type ExistsResp ¶
type ExistsResp struct {
Exists []bool `json:"exists"`
}
type GetEntryReq ¶
type GetEntryResp ¶
type HandleMapping ¶
type HandleMapping struct { Upwards func(blobcache.Handle) blobcache.Handle Downwards func(blobcache.Handle) blobcache.Handle }
func (HandleMapping) IsZero ¶
func (hm HandleMapping) IsZero() bool
type InspectHandleReq ¶
type InspectHandleResp ¶
type InspectHandleResp struct {
Info blobcache.HandleInfo `json:"info"`
}
type InspectVolumeReq ¶
type InspectVolumeResp ¶
type InspectVolumeResp struct {
Info *blobcache.VolumeInfo `json:"info"`
}
type KeepAliveReq ¶
type KeepAliveResp ¶
type KeepAliveResp struct{}
type ListNamesReq ¶
type ListNamesResp ¶
type ListNamesResp struct {
Names []string `json:"names"`
}
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func (*Message) Header ¶
func (m *Message) Header() MessageHeader
func (*Message) SetCode ¶
func (m *Message) SetCode(code MessageType)
type MessageHeader ¶
func (MessageHeader) BodyLen ¶
func (h MessageHeader) BodyLen() int
func (MessageHeader) Code ¶
func (h MessageHeader) Code() MessageType
func (*MessageHeader) SetBodyLen ¶
func (h *MessageHeader) SetBodyLen(bodyLen int)
func (*MessageHeader) SetCode ¶
func (h *MessageHeader) SetCode(code MessageType)
type MessageType ¶
type MessageType uint8
const ( MT_UNKNOWN MessageType = iota // MT_OK is the success response to a request. MT_OK // MT_PING is a request to ping the remote peer. MT_PING MT_HANDLE_INSPECT MT_HANDLE_DROP MT_HANDLE_KEEP_ALIVE MT_OPEN MT_NAMESPACE_OPEN_AT MT_NAMESPACE_GET_ENTRY MT_NAMESPACE_PUT_ENTRY MT_NAMESPACE_DELETE_ENTRY MT_NAMESPACE_LIST_NAMES MT_VOLUME_INSPECT MT_VOLUME_AWAIT MT_VOLUME_BEGIN_TX MT_TX_COMMIT MT_TX_ABORT MT_TX_LOAD MT_TX_POST MT_TX_POST_SALT MT_TX_GET MT_TX_EXISTS MT_TX_DELETE // MT_LAYER2_TELL is used for volume implementations to communicate with other volumes. MT_LAYER2_TELL // MT_LAYER2_ASK is used for volume implementations to communicate with other volumes. MT_LAYER2_ASK MT_ERROR = 255 )
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func New ¶
func New(privateKey ed25519.PrivateKey, pc net.PacketConn) *Node
func (*Node) Ask ¶
func (n *Node) Ask(ctx context.Context, remote blobcache.Endpoint, req Message, resp *Message) error
Ask opens a bidirectional stream to the given peer and sends the given request, then waits for a response.
func (*Node) LocalEndpoint ¶
type OpenAtResp ¶
type PutEntryReq ¶
type PutEntryResp ¶
type PutEntryResp struct{}
type Server ¶
type Server struct {
Access AccessFunc
}
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx is a transaction on a remote volume.
type Volume ¶
type Volume struct {
// contains filtered or unexported fields
}
Volume is a remote volume.
type WireError ¶
type WireError struct { InvalidHandle *blobcache.ErrInvalidHandle `json:"invalid_handle,omitempty"` NotFound *blobcache.ErrNotFound `json:"not_found,omitempty"` Unknown *string `json:"unknown,omitempty"` }
Click to show internal directories.
Click to hide internal directories.