Cluster
Technical reference of Clúster.
This API is used in Cluster configuration.
Symbols
| Symbol | Class | Description |
|---|---|---|
| ClusterAdapter | type | ClusterAdapter defines a public type of API. |
| ClusterConfig | type | ClusterConfig defines a public type of API. |
| ClusterEventKind | type | ClusterEventKind defines a public type of API. |
| ClusterEventSessionInvalidated | const | ClusterEventSessionInvalidated defines a constant value of the API. |
| ClusterEventSessionDestroyed | const | ClusterEventSessionDestroyed defines a constant value of the API. |
| ClusterEventSocketPacket | const | ClusterEventSocketPacket defines a constant value of the API. |
| ClusterEventSocketRequest | const | ClusterEventSocketRequest defines a constant value of the API. |
| ClusterEventSocketResponse | const | ClusterEventSocketResponse defines a constant value of the API. |
| ClusterEventSocketRequestCancel | const | ClusterEventSocketRequestCancel defines a constant value of the API. |
| ClusterEventSocketDisconnect | const | ClusterEventSocketDisconnect defines a constant value of the API. |
| ClusterEventChannelClosed | const | ClusterEventChannelClosed defines a constant value of the API. |
| ClusterTargetKind | type | ClusterTargetKind defines a public type of API. |
| ClusterTargetAll | const | ClusterTargetAll defines a constant value of the API. |
| ClusterTargetSession | const | ClusterTargetSession defines a constant value of the API. |
| ClusterTargetSocket | const | ClusterTargetSocket defines a constant value of the API. |
| ClusterTargetGroup | const | ClusterTargetGroup defines a constant value of the API. |
| ClusterTargetChannel | const | ClusterTargetChannel defines a constant value of the API. |
| ClusterTarget | type | ClusterTarget defines a public type of API. |
| ClusterEvent | type | ClusterEvent defines a public type of API. |
| ClusterEventFunc | type | ClusterEventFunc defines a public type of API. |
| ClusterErrorFunc | type | ClusterErrorFunc defines a public type of API. |
| ClusterRuntime | type | ClusterRuntime defines a public type of API. |
| ClusterBuildCoordinator | type | ClusterBuildCoordinator defines a public type of API. |
| ClusterBuildRequest | type | ClusterBuildRequest defines a public type of API. |
| ClusterBuildLease | type | ClusterBuildLease defines a public type of API. |
| ClusterBuildArtifact | type | ClusterBuildArtifact defines a public type of API. |
| ClusterBuildFailure | type | ClusterBuildFailure defines a public type of API. |
| ClusterBuildResultState | type | ClusterBuildResultState defines a public type of API. |
| ClusterBuildResultCompleted | const | ClusterBuildResultCompleted defines a constant value of the API. |
| ClusterBuildResultFailed | const | ClusterBuildResultFailed defines a constant value of the API. |
| ClusterBuildResult | type | ClusterBuildResult defines a public type of API. |
| ClusterBuildWaitRequest | type | ClusterBuildWaitRequest defines a public type of API. |
| ClusterGroupDirectory | type | ClusterGroupDirectory defines a public type of API. |
| ClusterChannelDirectory | type | ClusterChannelDirectory defines a public type of API. |
| ClusterSocketRecord | type | ClusterSocketRecord defines a public type of API. |
| ClusterSocketDirectory | type | ClusterSocketDirectory defines a public type of API. |
ClusterAdapter
Declaration:
type ClusterAdapter interface {
GetName() string
OpenCluster(ctx context.Context, config ClusterConfig) (ClusterRuntime, error)
} ClusterAdapter defines a public type of API.
ClusterConfig
Declaration:
type ClusterConfig struct {
ProjectName string
InstanceID string
SessionTTL time.Duration
MaxMessageSize int64
} ClusterConfig defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
ProjectName | string | Name of the element. |
InstanceID | string | Associated identifier. |
SessionTTL | time.Duration | Public data associated with SessionTTL. |
MaxMessageSize | int64 | Size in bytes. |
ClusterEventKind
Declaration:
type ClusterEventKind uint8 ClusterEventKind defines a public type of API.
ClusterEventSessionInvalidated
Declaration:
ClusterEventSessionInvalidated ClusterEventKind = iota + 1 ClusterEventSessionInvalidated defines a constant value of the API.
ClusterEventSessionDestroyed
Declaration:
ClusterEventSessionDestroyed ClusterEventSessionDestroyed defines a constant value of the API.
ClusterEventSocketPacket
Declaration:
ClusterEventSocketPacket ClusterEventSocketPacket defines a constant value of the API.
ClusterEventSocketRequest
Declaration:
ClusterEventSocketRequest ClusterEventSocketRequest defines a constant value of the API.
ClusterEventSocketResponse
Declaration:
ClusterEventSocketResponse ClusterEventSocketResponse defines a constant value of the API.
ClusterEventSocketRequestCancel
Declaration:
ClusterEventSocketRequestCancel ClusterEventSocketRequestCancel defines a constant value of the API.
ClusterEventSocketDisconnect
Declaration:
ClusterEventSocketDisconnect ClusterEventSocketDisconnect defines a constant value of the API.
ClusterEventChannelClosed
Declaration:
ClusterEventChannelClosed ClusterEventChannelClosed defines a constant value of the API.
ClusterTargetKind
Declaration:
type ClusterTargetKind uint8 ClusterTargetKind defines a public type of API.
ClusterTargetAll
Declaration:
ClusterTargetAll ClusterTargetKind = iota + 1 ClusterTargetAll defines a constant value of the API.
ClusterTargetSession
Declaration:
ClusterTargetSession ClusterTargetSession defines a constant value of the API.
ClusterTargetSocket
Declaration:
ClusterTargetSocket ClusterTargetSocket defines a constant value of the API.
ClusterTargetGroup
Declaration:
ClusterTargetGroup ClusterTargetGroup defines a constant value of the API.
ClusterTargetChannel
Declaration:
ClusterTargetChannel ClusterTargetChannel defines a constant value of the API.
ClusterTarget
Declaration:
type ClusterTarget struct {
Kind ClusterTargetKind
SessionID string
SocketID string
GroupName string
ChannelID string
ExcludeSocketID string
} ClusterTarget defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Kind | ClusterTargetKind | Event or state class. |
SessionID | string | Associated identifier. |
SocketID | string | Associated identifier. |
GroupName | string | Name of the element. |
ChannelID | string | Associated identifier. |
ExcludeSocketID | string | Associated identifier. |
ClusterEvent
Declaration:
type ClusterEvent struct {
Kind ClusterEventKind
InstanceID string
SessionID string
Target ClusterTarget
CorrelationID []byte
TargetInstanceID string
CloseCode uint16
Payload []byte
} ClusterEvent defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Kind | ClusterEventKind | Event or state class. |
InstanceID | string | Associated identifier. |
SessionID | string | Associated identifier. |
Target | ClusterTarget | Destination of the operation. |
CorrelationID | []byte | Associated identifier. |
TargetInstanceID | string | Associated identifier. |
CloseCode | uint16 | Code that classifies the state. |
Payload | []byte | Public data associated with Payload. |
ClusterEventFunc
Declaration:
type ClusterEventFunc func(event ClusterEvent) ClusterEventFunc defines a public type of API.
ClusterErrorFunc
Declaration:
type ClusterErrorFunc func(err error) ClusterErrorFunc defines a public type of API.
ClusterRuntime
Declaration:
type ClusterRuntime interface {
SessionStorageRuntime
ClusterSocketDirectory
ClusterGroupDirectory
ClusterChannelDirectory
InstanceID() string
PublishSessionInvalidated(ctx context.Context, sessionID string) error
PublishSessionDestroyed(ctx context.Context, sessionID string) error
PublishSocketPacket(ctx context.Context, target ClusterTarget, payload []byte) error
PublishSocketRequest(ctx context.Context, socketID string, correlationID []byte, payload []byte) error
PublishSocketResponse(ctx context.Context, targetInstanceID string, correlationID []byte, payload []byte) error
PublishSocketRequestCancel(ctx context.Context, correlationID []byte) error
PublishSocketDisconnect(ctx context.Context, target ClusterTarget, targetInstanceID string, closeCode uint16) error
PublishChannelClose(ctx context.Context, channelID string) error
SubscribeClusterEvents(ctx context.Context, event ClusterEventFunc, failure ClusterErrorFunc) error
} ClusterRuntime defines a public type of API.
ClusterBuildCoordinator
Declaration:
type ClusterBuildCoordinator interface {
AcquireBuild(ctx context.Context, request ClusterBuildRequest) (ClusterBuildLease, error)
RenewBuild(ctx context.Context, lease ClusterBuildLease, ttl time.Duration) (ClusterBuildLease, error)
CompleteBuild(ctx context.Context, lease ClusterBuildLease, artifact ClusterBuildArtifact) error
FailBuild(ctx context.Context, lease ClusterBuildLease, failure ClusterBuildFailure) error
WaitBuild(ctx context.Context, request ClusterBuildWaitRequest) (ClusterBuildResult, error)
// InvalidateBuild conditionally retires a completed result whose shared
// files failed integrity or availability checks. Implementations must never
// delete a pending lease or a different completed generation.
InvalidateBuild(ctx context.Context, artifact ClusterBuildArtifact) error
} ClusterBuildCoordinator defines a public type of API.
ClusterBuildRequest
Declaration:
type ClusterBuildRequest struct {
Key string
SourceVersion string
LeaseTTL time.Duration
} ClusterBuildRequest defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Key | string | ID key. |
SourceVersion | string | Version of the element. |
LeaseTTL | time.Duration | Public data associated with LeaseTTL. |
ClusterBuildLease
Declaration:
type ClusterBuildLease struct {
Key string
SourceVersion string
Token string
OwnerInstanceID string
ExpiresAt time.Time
Acquired bool
} ClusterBuildLease defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Key | string | ID key. |
SourceVersion | string | Version of the element. |
Token | string | Token associate. |
OwnerInstanceID | string | Associated identifier. |
ExpiresAt | time.Time | Time mark. |
Acquired | bool | Public data associated with Acquired. |
ClusterBuildArtifact
Declaration:
type ClusterBuildArtifact struct {
Key string
SourceVersion string
BuildVersion string
GeneratedRelativePath string
PluginRelativePath string
PluginSize int64
PluginSHA256 string
ManifestRelativePath string
ManifestSize int64
ManifestSHA256 string
} ClusterBuildArtifact defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Key | string | ID key. |
SourceVersion | string | Version of the element. |
BuildVersion | string | Version of the element. |
GeneratedRelativePath | string | Resource route. |
PluginRelativePath | string | Resource route. |
PluginSize | int64 | Size in bytes. |
PluginSHA256 | string | Hash SHA-256 integrity. |
ManifestRelativePath | string | Resource route. |
ManifestSize | int64 | Size in bytes. |
ManifestSHA256 | string | Hash SHA-256 integrity. |
ClusterBuildFailure
Declaration:
type ClusterBuildFailure struct {
Key string
SourceVersion string
Code string
Message string
} ClusterBuildFailure defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Key | string | ID key. |
SourceVersion | string | Version of the element. |
Code | string | Code that classifies the state. |
Message | string | A descriptive message. |
ClusterBuildResultState
Declaration:
type ClusterBuildResultState uint8 ClusterBuildResultState defines a public type of API.
ClusterBuildResultCompleted
Declaration:
ClusterBuildResultCompleted ClusterBuildResultState = iota + 1 ClusterBuildResultCompleted defines a constant value of the API.
ClusterBuildResultFailed
Declaration:
ClusterBuildResultFailed ClusterBuildResultFailed defines a constant value of the API.
ClusterBuildResult
Declaration:
type ClusterBuildResult struct {
State ClusterBuildResultState
Artifact ClusterBuildArtifact
Failure ClusterBuildFailure
} ClusterBuildResult defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
State | ClusterBuildResultState | Public data associated with State. |
Artifact | ClusterBuildArtifact | Public data associated with Artifact. |
Failure | ClusterBuildFailure | Public data associated with Failure. |
ClusterBuildWaitRequest
Declaration:
type ClusterBuildWaitRequest struct {
Key string
SourceVersion string
} ClusterBuildWaitRequest defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Key | string | ID key. |
SourceVersion | string | Version of the element. |
ClusterGroupDirectory
Declaration:
type ClusterGroupDirectory interface {
JoinGroup(ctx context.Context, group string, socket ClusterSocketRecord) error
LeaveGroup(ctx context.Context, group, socketID, instanceID string) error
LeaveAllGroups(ctx context.Context, socketID, instanceID string) error
ListGroups(ctx context.Context) ([]string, error)
ListGroupSockets(ctx context.Context, group string) ([]ClusterSocketRecord, error)
ListSocketGroups(ctx context.Context, socketID string) ([]string, error)
CountGroups(ctx context.Context) (int, error)
CountGroupSockets(ctx context.Context, group string) (int, error)
} ClusterGroupDirectory defines a public type of API.
ClusterChannelDirectory
Declaration:
type ClusterChannelDirectory interface {
JoinChannel(ctx context.Context, channelID string, socket ClusterSocketRecord) error
LeaveChannel(ctx context.Context, channelID, socketID, instanceID string) error
LeaveAllChannels(ctx context.Context, socketID, instanceID string) error
ListChannels(ctx context.Context) ([]string, error)
ListChannelSockets(ctx context.Context, channelID string) ([]ClusterSocketRecord, error)
ListSocketChannels(ctx context.Context, socketID string) ([]string, error)
CountChannels(ctx context.Context) (int, error)
CountChannelSockets(ctx context.Context, channelID string) (int, error)
CloseChannel(ctx context.Context, channelID string) error
} ClusterChannelDirectory defines a public type of API.
ClusterSocketRecord
Declaration:
type ClusterSocketRecord struct {
ID string
SessionID string
InstanceID string
} ClusterSocketRecord defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
ID | string | Unique identifier. |
SessionID | string | Associated identifier. |
InstanceID | string | Associated identifier. |
ClusterSocketDirectory
Declaration:
type ClusterSocketDirectory interface {
RegisterSocket(ctx context.Context, record ClusterSocketRecord) error
UnregisterSocket(ctx context.Context, socketID string) error
GetSocket(ctx context.Context, socketID string) (ClusterSocketRecord, bool, error)
ListSockets(ctx context.Context) ([]ClusterSocketRecord, error)
ListSessionSockets(ctx context.Context, sessionID string) ([]ClusterSocketRecord, error)
CountSockets(ctx context.Context) (int, error)
RefreshInstance(ctx context.Context, instanceID string) error
RemoveInstance(ctx context.Context, instanceID string) error
} ClusterSocketDirectory defines a public type of API.