Documentation
¶
Overview ¶
Package cluster schedules bounded chunk compression over HTTP, independently of storage. Authorization and discovery belong to the caller's control plane.
Index ¶
- Constants
- Variables
- func Hash(data []byte) string
- func JobProof(j Job) []byte
- func ResultProof(requestID string, result Result, h http.Header, status int) []byte
- func SetJob(r *http.Request, j Job) error
- type Codec
- type Config
- type ForwardConfig
- type Forwarder
- type Job
- type Member
- type Result
- type Server
- type ServerConfig
- type ServerStats
- type Stats
Constants ¶
const ( Version = 1 EncodeOperation = "compute:encode" EncodePath = "/v1/compute/encode" JobHeader = "X-Compactfs-Compute-Job" ResultHeader = "X-Compactfs-Compute-Result" JobProofHeader = "X-Cpfs-Compute-Job-Proof" ResultProofHeader = "X-Cpfs-Compute-Result-Proof" DefaultMaxChunkBytes int64 = 64 << 20 )
Variables ¶
Functions ¶
func JobProof ¶
JobProof is the bounded, domain-separated description the authorization layer authenticates in addition to its exact STS object scope.
func ResultProof ¶
ResultProof binds a response to the initiating request, the complete result description, and transport semantics without MACing bulk bytes.
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec owns only its default transport and bounded admission slots. It borrows Local and Nodes. No caller output is written before full validation.
type Config ¶
type Config struct {
NamespaceID string
Local codec.Codec
Nodes func() []Member
HTTPClient *http.Client
MaxChunkBytes int64
MaxConcurrent int
QueueDepth int
RemoteTimeout time.Duration
MinBytes int64
LocalBytesPerSecond float64
NetworkBytesPerSecond float64
RoundTrip time.Duration
EstimatedRatio float64
ForceRemote bool
Authorize func(*http.Request, Job) error
VerifyResponse func(*http.Response, Result) error
}
type ForwardConfig ¶
type Forwarder ¶
type Forwarder struct {
// contains filtered or unexported fields
}
func NewForwarder ¶
func NewForwarder(cfg ForwardConfig) (*Forwarder, error)
NewForwarder streams only to a registry-approved compute endpoint. It accepts logical node routes, never a caller-provided upstream URL.
type Job ¶
type Job struct {
NamespaceID string `json:"namespace_id,omitempty"`
Version int `json:"version"`
Operation string `json:"operation"`
NodeID string `json:"node_id"`
StorageIncarnation string `json:"storage_incarnation"`
RequestID string `json:"request_id"`
Algorithm string `json:"algorithm"`
RawHash string `json:"raw_hash"`
RawSize int64 `json:"raw_size"`
}
type Member ¶
type Member struct {
NodeID string
StorageIncarnation string
Endpoint string
Algorithms []string
EncodeBytesPerSecond float64
NetworkBytesPerSecond float64
QueueDepth int
Active int
MaxConcurrent int
RoundTrip time.Duration
}
Member is one lease-valid compute service, supplied as an owned registry snapshot. Rates are scheduling estimates, in bytes/second; zero uses Config.
type Result ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(cfg ServerConfig) (*Server, error)
func (*Server) Stats ¶
func (s *Server) Stats() ServerStats
type ServerConfig ¶
type ServerConfig struct {
NodeID string
StorageIncarnation string
Codecs map[string]codec.Codec
MaxChunkBytes int64
MaxConcurrent int
QueueDepth int
Timeout time.Duration
// Guard serializes this complete request with authority/revocation updates.
// It must retain admission until fn returns and must not recursively lock
// operations used by Authorize/SignResponse. Static authorization may omit it.
Guard func(context.Context, func() error) error
Authorize func(*http.Request, Job) error
SignResponse func(*http.Request, Result, http.Header) error
}
type ServerStats ¶
type ServerStats struct {
Active int `json:"active"`
QueueDepth int64 `json:"queue_depth"`
MaxConcurrent int `json:"max_concurrent"`
Completed uint64 `json:"completed"`
Failed uint64 `json:"failed"`
Rejected uint64 `json:"rejected"`
RawBytes uint64 `json:"raw_bytes"`
EncodedBytes uint64 `json:"encoded_bytes"`
}
type Stats ¶
type Stats struct {
RemoteAttempts uint64 `json:"remote_attempts"`
RemoteSuccess uint64 `json:"remote_success"`
CPUFallbacks uint64 `json:"cpu_fallbacks"`
LocalSelections uint64 `json:"local_selections"`
Rejected uint64 `json:"rejected"`
Active int `json:"active"`
QueueDepth int64 `json:"queue_depth"`
}