Documentation
¶
Overview ¶
Package bcp implements the Blobcache Protocol (BCP).
Index ¶
- Constants
- func Abort(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle) error
- func AddFrom(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle, ...) error
- func BeginTx(ctx context.Context, tp Asker, ep blobcache.Endpoint, volh blobcache.Handle, ...) (*blobcache.Handle, *blobcache.TxInfo, error)
- func CloneVolume(ctx context.Context, tp Asker, ep blobcache.Endpoint, caller *blobcache.PeerID, ...) (*blobcache.Handle, error)
- func Commit(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle, ...) error
- func CreateQueue(ctx context.Context, tp Asker, ep blobcache.Endpoint, ...) (*blobcache.Handle, error)
- func CreateVolume(ctx context.Context, tp Asker, ep blobcache.Endpoint, ...) (*blobcache.Handle, error)
- func Delete(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle, ...) error
- func Dequeue(ctx context.Context, tp Asker, ep blobcache.Endpoint, qh blobcache.Handle, ...) (int, error)
- func Drop(ctx context.Context, tp Asker, ep blobcache.Endpoint, h blobcache.Handle) error
- func Endpoint(ctx context.Context, tp Asker) (blobcache.Endpoint, error)
- func Enqueue(ctx context.Context, tp Asker, ep blobcache.Endpoint, qh blobcache.Handle, ...) (*blobcache.InsertResp, error)
- func Exists(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle, ...) error
- func Get(ctx context.Context, tp Asker, ep blobcache.Endpoint, txh blobcache.Handle, ...) (int, error)
- func InspectHandle(ctx context.Context, tp Asker, ep blobcache.Endpoint, h blobcache.Handle) (*blobcache.HandleInfo, error)
- func InspectQueue(ctx context.Context, tp Asker, ep blobcache.Endpoint, qh blobcache.Handle) (blobcache.QueueInfo, error)
- func InspectTx(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle) (*blobcache.TxInfo, error)
- func InspectVolume(ctx context.Context, tp Asker, ep blobcache.Endpoint, vol blobcache.Handle) (*blobcache.VolumeInfo, error)
- func IsVisited(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle, ...) error
- func KeepAlive(ctx context.Context, tp Asker, ep blobcache.Endpoint, hs []blobcache.Handle) error
- func Link(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle, ...) (*blobcache.LinkToken, error)
- func Load(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle, ...) error
- func OpenFiat(ctx context.Context, tp Asker, ep blobcache.Endpoint, target blobcache.OID, ...) (*blobcache.Handle, *blobcache.VolumeInfo, error)
- func OpenFrom(ctx context.Context, tp Asker, ep blobcache.Endpoint, base blobcache.Handle, ...) (*blobcache.Handle, *blobcache.VolumeInfo, error)
- func Ping(ctx context.Context, tp Asker, ep blobcache.Endpoint) error
- func Post(ctx context.Context, tp Asker, ep blobcache.Endpoint, txh blobcache.Handle, ...) (blobcache.CID, error)
- func Save(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle, ...) error
- func Serve(ctx context.Context, lis net.Listener, srv Handler) error
- func ServeStream(ctx context.Context, ep blobcache.Endpoint, conn io.ReadWriteCloser, ...) error
- func Share(ctx context.Context, tp Asker, ep blobcache.Endpoint, h blobcache.Handle, ...) (*blobcache.Handle, error)
- func SubToVolume(ctx context.Context, tp Asker, ep blobcache.Endpoint, qh blobcache.Handle, ...) error
- func Unlink(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle, ...) error
- func Visit(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle, ...) error
- func VisitLinks(ctx context.Context, tp Asker, ep blobcache.Endpoint, tx blobcache.Handle, ...) error
- type AbortReq
- type AbortResp
- type AccessFunc
- type AddFromReq
- type AddFromResp
- type Asker
- type BeginTxReq
- type BeginTxResp
- type CloneVolumeReq
- type CloneVolumeResp
- type CommitReq
- type CommitResp
- type CreateQueueReq
- type CreateQueueResp
- type CreateVolumeReq
- type CreateVolumeResp
- type DeleteReq
- type DeleteResp
- type DequeueReq
- type DequeueResp
- type DropReq
- type DropResp
- type EndpointReq
- type EndpointResp
- type EnqueueReq
- type EnqueueResp
- type ExistsReq
- type ExistsResp
- type GetReq
- type GetResp
- type Handler
- type InspectHandleReq
- type InspectHandleResp
- type InspectQueueReq
- type InspectQueueResp
- type InspectTxReq
- type InspectTxResp
- type InspectVolumeReq
- type InspectVolumeResp
- type IsVisitedReq
- type IsVisitedResp
- type KeepAliveReq
- type KeepAliveResp
- type LinkReq
- type LinkResp
- type LoadReq
- type LoadResp
- type Marshaller
- type Message
- func (m *Message) Body() []byte
- func (m *Message) Header() MessageHeader
- func (m *Message) ReadDatagramFrom(r io.Reader, alloc int) error
- 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) SetSendable(x Sendable)
- func (m *Message) WriteTo(w io.Writer) (int64, error)
- type MessageHeader
- type MessageType
- type OpenFiatReq
- type OpenFiatResp
- type OpenFromReq
- type OpenFromResp
- type SaveReq
- type SaveResp
- type Sendable
- type Server
- type ShareReq
- type ShareResp
- type SubToVolumeReq
- type SubToVolumeResp
- type Teller
- type TopicMessage
- type TopicTellMsg
- type UnlinkReq
- type UnlinkResp
- type Unmarshaller
- type VisitLinksReq
- type VisitLinksResp
- type VisitReq
- type VisitResp
Constants ¶
View Source
const ( MT_OK = 128 + iota MT_ERROR_TIMEOUT MT_ERROR_INVALID_HANDLE MT_ERROR_NOT_FOUND MT_ERROR_NO_PERMISSION MT_ERROR_NO_LINK MT_ERROR_TOO_LARGE MT_ERROR_UNKNOWN = 255 )
Response messages
View Source
const HeaderLen = 8
Variables ¶
This section is empty.
Functions ¶
func CloneVolume ¶
func CreateQueue ¶
func CreateVolume ¶
func InspectHandle ¶
func InspectQueue ¶ added in v0.4.0
func InspectVolume ¶
func ServeStream ¶ added in v0.4.0
func ServeStream(ctx context.Context, ep blobcache.Endpoint, conn io.ReadWriteCloser, srv Handler) error
ServeStream serves BCP over a bidi-stream
func SubToVolume ¶
Types ¶
type AccessFunc ¶ added in v0.4.0
AccessFunc is called to get a Service to access If the returned Service is nil, then the connection is disconnected as quickly as possible, and no further information should be sent to the initiator.
"Get off the phone" https://i.gifer.com/2Yv2.gif
type AddFromReq ¶
func (AddFromReq) Marshal ¶
func (ar AddFromReq) Marshal(out []byte) []byte
func (*AddFromReq) Unmarshal ¶
func (ar *AddFromReq) Unmarshal(data []byte) error
type AddFromResp ¶
type AddFromResp struct {
Added []bool
}
func (AddFromResp) Marshal ¶
func (ar AddFromResp) Marshal(out []byte) []byte
func (*AddFromResp) Unmarshal ¶
func (ar *AddFromResp) Unmarshal(data []byte) error
type BeginTxReq ¶
func (BeginTxReq) Marshal ¶
func (btx BeginTxReq) Marshal(out []byte) []byte
func (*BeginTxReq) Unmarshal ¶
func (btx *BeginTxReq) Unmarshal(data []byte) error
type BeginTxResp ¶
type BeginTxResp struct {
// Tx is the handle for the transaction.
Tx blobcache.Handle
// VolumeInfo is the volume info for the transaction.
Info blobcache.TxInfo
}
func (BeginTxResp) Marshal ¶
func (btx BeginTxResp) Marshal(out []byte) []byte
func (*BeginTxResp) Unmarshal ¶
func (btx *BeginTxResp) Unmarshal(data []byte) error
type CloneVolumeReq ¶
func (CloneVolumeReq) Marshal ¶
func (cr CloneVolumeReq) Marshal(out []byte) []byte
func (*CloneVolumeReq) Unmarshal ¶
func (cr *CloneVolumeReq) Unmarshal(data []byte) error
type CloneVolumeResp ¶
func (CloneVolumeResp) Marshal ¶
func (cr CloneVolumeResp) Marshal(out []byte) []byte
func (*CloneVolumeResp) Unmarshal ¶
func (cr *CloneVolumeResp) Unmarshal(data []byte) error
type CommitReq ¶
type CommitResp ¶
type CommitResp struct{}
func (CommitResp) Marshal ¶
func (cr CommitResp) Marshal(out []byte) []byte
func (*CommitResp) Unmarshal ¶
func (cr *CommitResp) Unmarshal(data []byte) error
type CreateQueueReq ¶
func (CreateQueueReq) Marshal ¶
func (cq CreateQueueReq) Marshal(out []byte) []byte
func (*CreateQueueReq) Unmarshal ¶
func (cq *CreateQueueReq) Unmarshal(data []byte) error
type CreateQueueResp ¶
func (CreateQueueResp) Marshal ¶
func (cq CreateQueueResp) Marshal(out []byte) []byte
func (*CreateQueueResp) Unmarshal ¶
func (cq *CreateQueueResp) Unmarshal(data []byte) error
type CreateVolumeReq ¶
type CreateVolumeReq struct {
Spec blobcache.VolumeSpec
}
func (CreateVolumeReq) Marshal ¶
func (cr CreateVolumeReq) Marshal(out []byte) []byte
func (*CreateVolumeReq) Unmarshal ¶
func (cr *CreateVolumeReq) Unmarshal(data []byte) error
type CreateVolumeResp ¶
type CreateVolumeResp struct {
Handle blobcache.Handle
Info blobcache.VolumeInfo
}
func (CreateVolumeResp) Marshal ¶
func (cr CreateVolumeResp) Marshal(out []byte) []byte
func (*CreateVolumeResp) Unmarshal ¶
func (cr *CreateVolumeResp) Unmarshal(data []byte) error
type DeleteResp ¶
type DeleteResp struct{}
func (DeleteResp) Marshal ¶
func (dr DeleteResp) Marshal(out []byte) []byte
func (*DeleteResp) Unmarshal ¶
func (dr *DeleteResp) Unmarshal(data []byte) error
type DequeueReq ¶ added in v0.4.0
type DequeueReq struct {
Queue blobcache.Handle
Opts blobcache.DequeueOpts
Max int
}
func (DequeueReq) Marshal ¶ added in v0.4.0
func (dr DequeueReq) Marshal(out []byte) []byte
func (*DequeueReq) Unmarshal ¶ added in v0.4.0
func (dr *DequeueReq) Unmarshal(data []byte) error
type DequeueResp ¶ added in v0.4.0
func (DequeueResp) Marshal ¶ added in v0.4.0
func (nr DequeueResp) Marshal(out []byte) []byte
func (*DequeueResp) Unmarshal ¶ added in v0.4.0
func (nr *DequeueResp) Unmarshal(data []byte) error
type EndpointReq ¶ added in v0.4.0
type EndpointReq struct{}
func (EndpointReq) Marshal ¶ added in v0.4.0
func (req EndpointReq) Marshal(out []byte) []byte
func (*EndpointReq) Unmarshal ¶ added in v0.4.0
func (req *EndpointReq) Unmarshal(out []byte) error
type EndpointResp ¶ added in v0.4.0
func (EndpointResp) Marshal ¶ added in v0.4.0
func (ep EndpointResp) Marshal(out []byte) []byte
func (*EndpointResp) Unmarshal ¶ added in v0.4.0
func (ep *EndpointResp) Unmarshal(out []byte) error
type EnqueueReq ¶ added in v0.4.0
func (EnqueueReq) Marshal ¶ added in v0.4.0
func (er EnqueueReq) Marshal(out []byte) []byte
func (*EnqueueReq) Unmarshal ¶ added in v0.4.0
func (er *EnqueueReq) Unmarshal(data []byte) error
type EnqueueResp ¶ added in v0.4.0
type EnqueueResp struct {
Success uint32
}
func (EnqueueResp) Marshal ¶ added in v0.4.0
func (ir EnqueueResp) Marshal(out []byte) []byte
func (*EnqueueResp) Unmarshal ¶ added in v0.4.0
func (ir *EnqueueResp) Unmarshal(data []byte) error
type ExistsResp ¶
type ExistsResp struct {
Exists []bool
}
func (ExistsResp) Marshal ¶
func (er ExistsResp) Marshal(out []byte) []byte
func (*ExistsResp) Unmarshal ¶
func (er *ExistsResp) Unmarshal(data []byte) error
type InspectHandleReq ¶
func (InspectHandleReq) Marshal ¶
func (ir InspectHandleReq) Marshal(out []byte) []byte
func (*InspectHandleReq) Unmarshal ¶
func (ir *InspectHandleReq) Unmarshal(data []byte) error
type InspectHandleResp ¶
type InspectHandleResp struct {
Info blobcache.HandleInfo
}
func (InspectHandleResp) Marshal ¶
func (ir InspectHandleResp) Marshal(out []byte) []byte
func (*InspectHandleResp) Unmarshal ¶
func (ir *InspectHandleResp) Unmarshal(data []byte) error
type InspectQueueReq ¶
func (InspectQueueReq) Marshal ¶
func (iq InspectQueueReq) Marshal(out []byte) []byte
func (*InspectQueueReq) Unmarshal ¶
func (iq *InspectQueueReq) Unmarshal(data []byte) error
type InspectQueueResp ¶
func (InspectQueueResp) Marshal ¶
func (iq InspectQueueResp) Marshal(out []byte) []byte
func (*InspectQueueResp) Unmarshal ¶
func (iq *InspectQueueResp) Unmarshal(data []byte) error
type InspectTxReq ¶
func (InspectTxReq) Marshal ¶
func (r InspectTxReq) Marshal(out []byte) []byte
func (*InspectTxReq) Unmarshal ¶
func (r *InspectTxReq) Unmarshal(data []byte) error
type InspectTxResp ¶
func (InspectTxResp) Marshal ¶
func (r InspectTxResp) Marshal(out []byte) []byte
func (*InspectTxResp) Unmarshal ¶
func (r *InspectTxResp) Unmarshal(data []byte) error
type InspectVolumeReq ¶
func (InspectVolumeReq) Marshal ¶
func (iv InspectVolumeReq) Marshal(out []byte) []byte
func (*InspectVolumeReq) Unmarshal ¶
func (iv *InspectVolumeReq) Unmarshal(data []byte) error
type InspectVolumeResp ¶
type InspectVolumeResp struct {
Info blobcache.VolumeInfo
}
func (InspectVolumeResp) Marshal ¶
func (iv InspectVolumeResp) Marshal(out []byte) []byte
func (*InspectVolumeResp) Unmarshal ¶
func (iv *InspectVolumeResp) Unmarshal(data []byte) error
type IsVisitedReq ¶
func (IsVisitedReq) Marshal ¶
func (ir IsVisitedReq) Marshal(out []byte) []byte
func (*IsVisitedReq) Unmarshal ¶
func (ir *IsVisitedReq) Unmarshal(data []byte) error
type IsVisitedResp ¶
type IsVisitedResp struct {
Visited []bool
}
func (IsVisitedResp) Marshal ¶
func (ir IsVisitedResp) Marshal(out []byte) []byte
func (*IsVisitedResp) Unmarshal ¶
func (ir *IsVisitedResp) Unmarshal(data []byte) error
type KeepAliveReq ¶
func (KeepAliveReq) Marshal ¶
func (kr KeepAliveReq) Marshal(out []byte) []byte
func (*KeepAliveReq) Unmarshal ¶
func (kr *KeepAliveReq) Unmarshal(data []byte) error
type KeepAliveResp ¶
type KeepAliveResp struct{}
func (KeepAliveResp) Marshal ¶
func (kr KeepAliveResp) Marshal(out []byte) []byte
func (*KeepAliveResp) Unmarshal ¶
func (kr *KeepAliveResp) Unmarshal(data []byte) error
type Marshaller ¶ added in v0.4.0
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func NewMessage ¶ added in v0.4.0
func (*Message) Header ¶
func (m *Message) Header() MessageHeader
func (*Message) ReadDatagramFrom ¶ added in v0.4.0
func (*Message) SetCode ¶
func (m *Message) SetCode(code MessageType)
func (*Message) SetSendable ¶
SetSendable sets the body of the message to a Sendable
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_PING is a request to ping the remote peer. MT_PING // MT_ENDPOINT is a request for the remote to respond with its Endpoint MT_ENDPOINT )
const ( MT_HANDLE_INSPECT MessageType = 16 + iota MT_HANDLE_DROP MT_HANDLE_KEEP_ALIVE MT_HANDLE_SHARE )
Handle messages
const ( MT_OPEN_FIAT MessageType = 32 + iota MT_OPEN_FROM MT_VOLUME_INSPECT MT_VOLUME_AWAIT MT_VOLUME_BEGIN_TX MT_VOLUME_CLONE MT_CREATE_VOLUME MessageType = 47 )
Volume messages
const ( MT_TX_INSPECT MessageType = 48 + iota MT_TX_COMMIT MT_TX_ABORT MT_TX_LOAD MT_TX_SAVE MT_TX_POST MT_TX_POST_SALT MT_TX_GET MT_TX_EXISTS MT_TX_DELETE MT_TX_ADD_FROM MT_TX_VISIT MT_TX_IS_VISITED MT_TX_LINK MT_TX_UNLINK MT_TX_VISIT_LINKS )
Tx messages
const ( MT_QUEUE_INSPECT MessageType = 80 + iota MT_QUEUE_ENQUEUE MT_QUEUE_DEQUEUE MT_QUEUE_SUB_TO_VOLUME MT_QUEUE_CREATE MessageType = 96 )
func (MessageType) IsError ¶
func (mt MessageType) IsError() bool
func (MessageType) IsOK ¶
func (mt MessageType) IsOK() bool
type OpenFiatReq ¶
func (OpenFiatReq) Marshal ¶
func (oa OpenFiatReq) Marshal(out []byte) []byte
func (*OpenFiatReq) Unmarshal ¶
func (oa *OpenFiatReq) Unmarshal(data []byte) error
type OpenFiatResp ¶
type OpenFiatResp struct {
Handle blobcache.Handle
Info blobcache.VolumeInfo
}
func (OpenFiatResp) Marshal ¶
func (oa OpenFiatResp) Marshal(out []byte) []byte
func (*OpenFiatResp) Unmarshal ¶
func (oa *OpenFiatResp) Unmarshal(data []byte) error
type OpenFromReq ¶
type OpenFromReq struct {
Base blobcache.Handle
Token blobcache.LinkToken
Mask blobcache.ActionSet
}
func (OpenFromReq) Marshal ¶
func (of OpenFromReq) Marshal(out []byte) []byte
func (*OpenFromReq) Unmarshal ¶
func (of *OpenFromReq) Unmarshal(data []byte) error
type OpenFromResp ¶
type OpenFromResp struct {
Handle blobcache.Handle
Info blobcache.VolumeInfo
}
func (OpenFromResp) Marshal ¶
func (of OpenFromResp) Marshal(out []byte) []byte
func (*OpenFromResp) Unmarshal ¶
func (of *OpenFromResp) Unmarshal(data []byte) error
type Server ¶ added in v0.4.0
type Server struct {
Access AccessFunc
}
type SubToVolumeReq ¶
type SubToVolumeReq struct {
Queue blobcache.Handle
Volume blobcache.Handle
Spec blobcache.VolSubSpec
}
func (SubToVolumeReq) Marshal ¶
func (sr SubToVolumeReq) Marshal(out []byte) []byte
func (*SubToVolumeReq) Unmarshal ¶
func (sr *SubToVolumeReq) Unmarshal(data []byte) error
type SubToVolumeResp ¶
type SubToVolumeResp struct{}
func (SubToVolumeResp) Marshal ¶
func (sr SubToVolumeResp) Marshal(out []byte) []byte
func (*SubToVolumeResp) Unmarshal ¶
func (sr *SubToVolumeResp) Unmarshal(data []byte) error
type TopicMessage ¶ added in v0.4.0
type TopicTellMsg ¶
type TopicTellMsg struct {
// TopicHash is the hash of the topic ID
TopicHash blobcache.CID
Ciphertext []byte
}
func (*TopicTellMsg) Encrypt ¶
func (dst *TopicTellMsg) Encrypt(topicID blobcache.TID, ptext []byte)
Encrypt sets the message to contain ciphertext for ptext on topicID.
func (TopicTellMsg) Marshal ¶
func (ttm TopicTellMsg) Marshal(out []byte) []byte
func (*TopicTellMsg) Unmarshal ¶
func (ttm *TopicTellMsg) Unmarshal(data []byte) error
type UnlinkResp ¶
type UnlinkResp struct{}
func (UnlinkResp) Marshal ¶
func (ur UnlinkResp) Marshal(out []byte) []byte
func (*UnlinkResp) Unmarshal ¶
func (ur *UnlinkResp) Unmarshal(data []byte) error
type Unmarshaller ¶ added in v0.4.0
type VisitLinksReq ¶
func (VisitLinksReq) Marshal ¶
func (vr VisitLinksReq) Marshal(out []byte) []byte
func (*VisitLinksReq) Unmarshal ¶
func (vr *VisitLinksReq) Unmarshal(data []byte) error
type VisitLinksResp ¶
type VisitLinksResp struct{}
func (VisitLinksResp) Marshal ¶
func (vr VisitLinksResp) Marshal(out []byte) []byte
func (*VisitLinksResp) Unmarshal ¶
func (vr *VisitLinksResp) Unmarshal(data []byte) error
Click to show internal directories.
Click to hide internal directories.