Documentation
¶
Overview ¶
Package protocol defines the JSON protocol exchanged by connector binaries and Airlock. It has no platform or Agents SDK runtime dependencies.
Index ¶
- Constants
- func CanonicalJSON(value []byte) ([]byte, error)
- func HashJSON(value []byte) (string, error)
- func InterfaceDigest(value Interface) (string, error)
- func ValidateArtifactDigest(value string) error
- func ValidateContractID(id string) error
- func ValidateKind(kind string) error
- func ValidateManifest(m Manifest) error
- func ValidateName(kind, name string) error
- func ValidateRequirement(r Requirement) error
- func ValidateSettings(settings []SettingDescriptor) error
- type ActiveAttempt
- type CommandCallRequest
- type CommandCallResponse
- type CommandDescriptor
- type CommandMode
- type DeviceCodeRequest
- type DeviceCodeResponse
- type DirectoryDescriptor
- type DirectoryEntry
- type DirectoryExportRequest
- type DirectoryExportResponse
- type DirectoryImportRequest
- type DirectoryListRequest
- type DirectoryListResponse
- type DirectoryMoveRequest
- type DirectoryReadRequest
- type DirectoryReadResponse
- type DirectoryWriteRequest
- type EnrollmentRequest
- type EnrollmentResponse
- type Handshake
- type HeartbeatRequest
- type Interface
- type JobCompletion
- type JobEvent
- type JobKind
- type JobRequest
- type Manifest
- type OfflinePolicy
- type OrchestrationRequest
- type OrchestrationStrategy
- type Readiness
- type Requirement
- type SettingDescriptor
- type Target
- type TargetSelector
- type TransferGrant
- type UploadPartGrant
- type UploadedPart
Constants ¶
View Source
const ( Major = 1 Minor = 0 // MaxEnvelopeBytes matches Airlock's connector protocol request limit. MaxEnvelopeBytes = 1 << 20 // MaxJobPayloadBytes reserves enough room for the JSON completion envelope, // attempt token, status, and escaping under MaxEnvelopeBytes. MaxJobPayloadBytes = MaxEnvelopeBytes - (64 << 10) MaxInlineFileBytes = (MaxJobPayloadBytes * 3 / 4) - (16 << 10) MaxManifestBytes = 4 << 20 MaxSchemaBytes = 512 << 10 MaxTransferPartBytes = 16 << 20 MaxTransferParts = 10000 MaxDirectoryScanEntries = 10000 MaxActiveAttempts = 256 )
View Source
const ( PlatformLinuxAMD64 = "linux-amd64" PlatformLinuxARM64 = "linux-arm64" PlatformLinuxARMv7 = "linux-armv7" PlatformDarwinAMD64 = "darwin-amd64" PlatformDarwinARM64 = "darwin-arm64" PlatformWindowsAMD64 = "windows-amd64" PlatformWindowsARM64 = "windows-arm64" )
Variables ¶
This section is empty.
Functions ¶
func CanonicalJSON ¶
func InterfaceDigest ¶
func ValidateArtifactDigest ¶
func ValidateContractID ¶
func ValidateKind ¶
func ValidateManifest ¶
func ValidateName ¶
func ValidateRequirement ¶
func ValidateRequirement(r Requirement) error
func ValidateSettings ¶
func ValidateSettings(settings []SettingDescriptor) error
Types ¶
type ActiveAttempt ¶
type CommandCallRequest ¶
type CommandCallRequest struct {
RequestID string `json:"requestId,omitempty"`
Revision int `json:"revision"`
Mode CommandMode `json:"mode"`
InputSchemaHash string `json:"inputSchemaHash"`
OutputSchemaHash string `json:"outputSchemaHash"`
Input json.RawMessage `json:"input"`
Deadline *time.Time `json:"deadline,omitempty"`
}
type CommandCallResponse ¶
type CommandCallResponse struct {
JobID string `json:"jobId"`
Status string `json:"status"`
Output json.RawMessage `json:"output,omitempty"`
Error string `json:"error,omitempty"`
}
type CommandDescriptor ¶
type CommandDescriptor struct {
Name string `json:"name"`
Revision int `json:"revision"`
Description string `json:"description,omitempty"`
Mode CommandMode `json:"mode"`
InputSchema json.RawMessage `json:"inputSchema"`
OutputSchema json.RawMessage `json:"outputSchema"`
InputSchemaHash string `json:"inputSchemaHash"`
OutputSchemaHash string `json:"outputSchemaHash"`
}
type CommandMode ¶
type CommandMode string
const ( CommandModeUnary CommandMode = "unary" CommandModeJob CommandMode = "job" )
type DeviceCodeRequest ¶
type DeviceCodeRequest struct {
Manifest Manifest `json:"manifest"`
}
type DeviceCodeResponse ¶
type DeviceCodeResponse struct {
DeviceSecret string `json:"deviceSecret"`
UserCode string `json:"userCode"`
VerificationURL string `json:"verificationUrl"`
ExpiresAt time.Time `json:"expiresAt"`
PollIntervalSeconds int `json:"pollIntervalSeconds"`
StorageOrigins []string `json:"storageOrigins,omitempty"`
}
type DirectoryDescriptor ¶
type DirectoryEntry ¶
type DirectoryExportRequest ¶
type DirectoryExportRequest struct {
Path string `json:"path"`
PartSize int64 `json:"partSize"`
Parts []UploadPartGrant `json:"parts"`
Grant TransferGrant `json:"grant"`
}
type DirectoryExportResponse ¶
type DirectoryExportResponse struct {
Parts []UploadedPart `json:"parts"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
}
type DirectoryImportRequest ¶
type DirectoryImportRequest struct {
Path string `json:"path"`
Overwrite bool `json:"overwrite"`
Grant TransferGrant `json:"grant"`
}
type DirectoryListRequest ¶
type DirectoryListResponse ¶
type DirectoryListResponse struct {
Entries []DirectoryEntry `json:"entries"`
NextCursor string `json:"nextCursor,omitempty"`
}
type DirectoryMoveRequest ¶
type DirectoryReadRequest ¶
type DirectoryReadResponse ¶
type DirectoryReadResponse struct {
Entry DirectoryEntry `json:"entry"`
Data []byte `json:"data"`
}
type DirectoryWriteRequest ¶
type EnrollmentRequest ¶
type EnrollmentRequest struct {
DeviceSecret string `json:"deviceSecret"`
}
type EnrollmentResponse ¶
type HeartbeatRequest ¶
type HeartbeatRequest struct {
Handshake Handshake `json:"handshake"`
Readiness Readiness `json:"readiness"`
ArtifactVersion string `json:"artifactVersion"`
ArtifactDigest string `json:"artifactDigest"`
InterfaceHash string `json:"interfaceHash"`
ActiveAttempts []ActiveAttempt `json:"activeAttempts,omitempty"`
Error string `json:"error,omitempty"`
}
type Interface ¶
type Interface struct {
Kind string `json:"kind"`
ContractID string `json:"contractId"`
Name string `json:"name"`
Description string `json:"description"`
ArtifactVersion string `json:"artifactVersion"`
Commands []CommandDescriptor `json:"commands"`
Directories []DirectoryDescriptor `json:"directories"`
}
type JobCompletion ¶
type JobCompletion struct {
AttemptToken string `json:"attemptToken"`
Status string `json:"status"`
Output json.RawMessage `json:"output,omitempty"`
Error string `json:"error,omitempty"`
}
type JobKind ¶
type JobKind string
const ( JobKindCommand JobKind = "command" JobKindDirectoryList JobKind = "directory_list" JobKindDirectoryStat JobKind = "directory_stat" JobKindDirectoryRead JobKind = "directory_read" JobKindDirectoryWrite JobKind = "directory_write" JobKindDirectoryDelete JobKind = "directory_delete" JobKindDirectoryMove JobKind = "directory_move" JobKindDirectoryImport JobKind = "directory_import" JobKindDirectoryExport JobKind = "directory_export" JobKindCancel JobKind = "cancel" )
type JobRequest ¶
type JobRequest struct {
JobID string `json:"jobId"`
AttemptToken string `json:"attemptToken"`
IdempotencyID string `json:"idempotencyId"`
Kind JobKind `json:"kind"`
Operation string `json:"operation"`
Revision int `json:"revision"`
Mode CommandMode `json:"mode,omitempty"`
InputSchemaHash string `json:"inputSchemaHash,omitempty"`
OutputSchemaHash string `json:"outputSchemaHash,omitempty"`
Input json.RawMessage `json:"input"`
Deadline time.Time `json:"deadline"`
}
type Manifest ¶
type Manifest struct {
ProtocolMajor int `json:"protocolMajor"`
ProtocolMinor int `json:"protocolMinor"`
Features []string `json:"features"`
Targets []string `json:"targets"`
ServiceMode string `json:"serviceMode"`
Interface Interface `json:"interface"`
InterfaceHash string `json:"interfaceHash"`
ArtifactDigest string `json:"artifactDigest"`
Settings []SettingDescriptor `json:"settings"`
}
type OfflinePolicy ¶
type OfflinePolicy string
const ( OfflineFail OfflinePolicy = "fail" OfflineSkip OfflinePolicy = "skip" OfflineWait OfflinePolicy = "wait" OfflineCancel OfflinePolicy = "cancel" )
type OrchestrationRequest ¶
type OrchestrationRequest struct {
RequestID string `json:"requestId"`
Targets TargetSelector `json:"targets"`
Strategy OrchestrationStrategy `json:"strategy"`
OfflinePolicy OfflinePolicy `json:"offlinePolicy"`
MaxConcurrency int `json:"maxConcurrency,omitempty"`
BatchSize int `json:"batchSize,omitempty"`
CanaryCount int `json:"canaryCount,omitempty"`
Quorum int `json:"quorum,omitempty"`
Deadline *time.Time `json:"deadline,omitempty"`
Command CommandCallRequest `json:"command"`
}
type OrchestrationStrategy ¶
type OrchestrationStrategy string
const ( StrategyParallel OrchestrationStrategy = "parallel" StrategySerial OrchestrationStrategy = "serial" StrategyRolling OrchestrationStrategy = "rolling" StrategyCanary OrchestrationStrategy = "canary" StrategyQuorum OrchestrationStrategy = "quorum" )
type Requirement ¶
type Requirement struct {
ContractID string `json:"contractId"`
Commands []CommandDescriptor `json:"commands"`
Directories []DirectoryDescriptor `json:"directories"`
}
type SettingDescriptor ¶
type Target ¶
type Target struct {
ID string
Architecture string
GOOS string
GOARCH string
ExecutableSuffix string
// contains filtered or unexported fields
}
Target defines one supported connector artifact platform and its Go build recipe. Connector manifests carry Target.ID values; builders own the recipe.
func LookupTarget ¶
LookupTarget returns the registered build target for id.
func SupportedTargets ¶
func SupportedTargets() []Target
SupportedTargets returns every registered target in stable order.
func (Target) SupportsServiceMode ¶
SupportsServiceMode reports whether target has a managed-service lifecycle for mode.
type TargetSelector ¶
type TransferGrant ¶
type UploadPartGrant ¶
type UploadedPart ¶
Click to show internal directories.
Click to hide internal directories.