Documentation
¶
Index ¶
- Constants
- func WithNamespace(ctx context.Context, ns string) context.Context
- type Client
- func (c *Client) Delete(ctx context.Context, key string) error
- func (c *Client) Exists(ctx context.Context, key string) (bool, error)
- func (c *Client) Get(ctx context.Context, key string) ([]byte, error)
- func (c *Client) List(ctx context.Context, prefix string, limit int) ([]string, error)
- func (c *Client) Put(ctx context.Context, key string, value []byte) error
- type MessageType
- type Service
- type StorageRequest
- type StorageResponse
Constants ¶
const CtxKeyNamespaceOverride ctxKey = "storage_ns_override"
CtxKeyNamespaceOverride is the context key used to override namespace per request
const (
StorageProtocolID = "/network/storage/1.0.0"
)
Storage protocol definitions for distributed storage
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides distributed storage client functionality
type MessageType ¶
type MessageType string
Message types for storage operations
const ( MessageTypePut MessageType = "put" MessageTypeGet MessageType = "get" MessageTypeDelete MessageType = "delete" MessageTypeList MessageType = "list" MessageTypeExists MessageType = "exists" )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides distributed storage functionality using RQLite
func NewService ¶
NewService creates a new storage service backed by RQLite
func (*Service) HandleStorageStream ¶
HandleStorageStream handles incoming storage protocol streams
type StorageRequest ¶
type StorageRequest struct {
Type MessageType `json:"type"`
Key string `json:"key"`
Value []byte `json:"value,omitempty"`
Prefix string `json:"prefix,omitempty"`
Limit int `json:"limit,omitempty"`
Namespace string `json:"namespace"`
}
StorageRequest represents a storage operation request
func (*StorageRequest) Marshal ¶
func (r *StorageRequest) Marshal() ([]byte, error)
Marshal serializes a request to JSON
func (*StorageRequest) Unmarshal ¶
func (r *StorageRequest) Unmarshal(data []byte) error
Unmarshal deserializes a request from JSON
type StorageResponse ¶
type StorageResponse struct {
Success bool `json:"success"`
Error string `json:"error,omitempty"`
Value []byte `json:"value,omitempty"`
Keys []string `json:"keys,omitempty"`
Exists bool `json:"exists,omitempty"`
}
StorageResponse represents a storage operation response
func (*StorageResponse) Marshal ¶
func (r *StorageResponse) Marshal() ([]byte, error)
Marshal serializes a response to JSON
func (*StorageResponse) Unmarshal ¶
func (r *StorageResponse) Unmarshal(data []byte) error
Unmarshal deserializes a response from JSON