Cluster

Technical reference of Clúster.

This API is used in Cluster configuration.


Symbols

SymbolClassDescription
ClusterAdaptertypeClusterAdapter defines a public type of API.
ClusterConfigtypeClusterConfig defines a public type of API.
ClusterEventKindtypeClusterEventKind defines a public type of API.
ClusterEventSessionInvalidatedconstClusterEventSessionInvalidated defines a constant value of the API.
ClusterEventSessionDestroyedconstClusterEventSessionDestroyed defines a constant value of the API.
ClusterEventSocketPacketconstClusterEventSocketPacket defines a constant value of the API.
ClusterEventSocketRequestconstClusterEventSocketRequest defines a constant value of the API.
ClusterEventSocketResponseconstClusterEventSocketResponse defines a constant value of the API.
ClusterEventSocketRequestCancelconstClusterEventSocketRequestCancel defines a constant value of the API.
ClusterEventSocketDisconnectconstClusterEventSocketDisconnect defines a constant value of the API.
ClusterEventChannelClosedconstClusterEventChannelClosed defines a constant value of the API.
ClusterTargetKindtypeClusterTargetKind defines a public type of API.
ClusterTargetAllconstClusterTargetAll defines a constant value of the API.
ClusterTargetSessionconstClusterTargetSession defines a constant value of the API.
ClusterTargetSocketconstClusterTargetSocket defines a constant value of the API.
ClusterTargetGroupconstClusterTargetGroup defines a constant value of the API.
ClusterTargetChannelconstClusterTargetChannel defines a constant value of the API.
ClusterTargettypeClusterTarget defines a public type of API.
ClusterEventtypeClusterEvent defines a public type of API.
ClusterEventFunctypeClusterEventFunc defines a public type of API.
ClusterErrorFunctypeClusterErrorFunc defines a public type of API.
ClusterRuntimetypeClusterRuntime defines a public type of API.
ClusterBuildCoordinatortypeClusterBuildCoordinator defines a public type of API.
ClusterBuildRequesttypeClusterBuildRequest defines a public type of API.
ClusterBuildLeasetypeClusterBuildLease defines a public type of API.
ClusterBuildArtifacttypeClusterBuildArtifact defines a public type of API.
ClusterBuildFailuretypeClusterBuildFailure defines a public type of API.
ClusterBuildResultStatetypeClusterBuildResultState defines a public type of API.
ClusterBuildResultCompletedconstClusterBuildResultCompleted defines a constant value of the API.
ClusterBuildResultFailedconstClusterBuildResultFailed defines a constant value of the API.
ClusterBuildResulttypeClusterBuildResult defines a public type of API.
ClusterBuildWaitRequesttypeClusterBuildWaitRequest defines a public type of API.
ClusterGroupDirectorytypeClusterGroupDirectory defines a public type of API.
ClusterChannelDirectorytypeClusterChannelDirectory defines a public type of API.
ClusterSocketRecordtypeClusterSocketRecord defines a public type of API.
ClusterSocketDirectorytypeClusterSocketDirectory defines a public type of API.

ClusterAdapter

Declaration:

gox
type ClusterAdapter interface {
	GetName() string
	OpenCluster(ctx context.Context, config ClusterConfig) (ClusterRuntime, error)
}

ClusterAdapter defines a public type of API.


ClusterConfig

Declaration:

gox
type ClusterConfig struct {
	ProjectName    string
	InstanceID     string
	SessionTTL     time.Duration
	MaxMessageSize int64
}

ClusterConfig defines a public type of API.

Fields

FieldTypeDescription
ProjectNamestringName of the element.
InstanceIDstringAssociated identifier.
SessionTTLtime.DurationPublic data associated with SessionTTL.
MaxMessageSizeint64Size in bytes.

ClusterEventKind

Declaration:

gox
type ClusterEventKind uint8

ClusterEventKind defines a public type of API.


ClusterEventSessionInvalidated

Declaration:

gox
ClusterEventSessionInvalidated ClusterEventKind = iota + 1

ClusterEventSessionInvalidated defines a constant value of the API.


ClusterEventSessionDestroyed

Declaration:

gox
ClusterEventSessionDestroyed

ClusterEventSessionDestroyed defines a constant value of the API.


ClusterEventSocketPacket

Declaration:

gox
ClusterEventSocketPacket

ClusterEventSocketPacket defines a constant value of the API.


ClusterEventSocketRequest

Declaration:

gox
ClusterEventSocketRequest

ClusterEventSocketRequest defines a constant value of the API.


ClusterEventSocketResponse

Declaration:

gox
ClusterEventSocketResponse

ClusterEventSocketResponse defines a constant value of the API.


ClusterEventSocketRequestCancel

Declaration:

gox
ClusterEventSocketRequestCancel

ClusterEventSocketRequestCancel defines a constant value of the API.


ClusterEventSocketDisconnect

Declaration:

gox
ClusterEventSocketDisconnect

ClusterEventSocketDisconnect defines a constant value of the API.


ClusterEventChannelClosed

Declaration:

gox
ClusterEventChannelClosed

ClusterEventChannelClosed defines a constant value of the API.


ClusterTargetKind

Declaration:

gox
type ClusterTargetKind uint8

ClusterTargetKind defines a public type of API.


ClusterTargetAll

Declaration:

gox
ClusterTargetAll ClusterTargetKind = iota + 1

ClusterTargetAll defines a constant value of the API.


ClusterTargetSession

Declaration:

gox
ClusterTargetSession

ClusterTargetSession defines a constant value of the API.


ClusterTargetSocket

Declaration:

gox
ClusterTargetSocket

ClusterTargetSocket defines a constant value of the API.


ClusterTargetGroup

Declaration:

gox
ClusterTargetGroup

ClusterTargetGroup defines a constant value of the API.


ClusterTargetChannel

Declaration:

gox
ClusterTargetChannel

ClusterTargetChannel defines a constant value of the API.


ClusterTarget

Declaration:

gox
type ClusterTarget struct {
	Kind            ClusterTargetKind
	SessionID       string
	SocketID        string
	GroupName       string
	ChannelID       string
	ExcludeSocketID string
}

ClusterTarget defines a public type of API.

Fields

FieldTypeDescription
KindClusterTargetKindEvent or state class.
SessionIDstringAssociated identifier.
SocketIDstringAssociated identifier.
GroupNamestringName of the element.
ChannelIDstringAssociated identifier.
ExcludeSocketIDstringAssociated identifier.

ClusterEvent

Declaration:

gox
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

FieldTypeDescription
KindClusterEventKindEvent or state class.
InstanceIDstringAssociated identifier.
SessionIDstringAssociated identifier.
TargetClusterTargetDestination of the operation.
CorrelationID[]byteAssociated identifier.
TargetInstanceIDstringAssociated identifier.
CloseCodeuint16Code that classifies the state.
Payload[]bytePublic data associated with Payload.

ClusterEventFunc

Declaration:

gox
type ClusterEventFunc func(event ClusterEvent)

ClusterEventFunc defines a public type of API.


ClusterErrorFunc

Declaration:

gox
type ClusterErrorFunc func(err error)

ClusterErrorFunc defines a public type of API.


ClusterRuntime

Declaration:

gox
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:

gox
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:

gox
type ClusterBuildRequest struct {
	Key           string
	SourceVersion string
	LeaseTTL      time.Duration
}

ClusterBuildRequest defines a public type of API.

Fields

FieldTypeDescription
KeystringID key.
SourceVersionstringVersion of the element.
LeaseTTLtime.DurationPublic data associated with LeaseTTL.

ClusterBuildLease

Declaration:

gox
type ClusterBuildLease struct {
	Key             string
	SourceVersion   string
	Token           string
	OwnerInstanceID string
	ExpiresAt       time.Time
	Acquired        bool
}

ClusterBuildLease defines a public type of API.

Fields

FieldTypeDescription
KeystringID key.
SourceVersionstringVersion of the element.
TokenstringToken associate.
OwnerInstanceIDstringAssociated identifier.
ExpiresAttime.TimeTime mark.
AcquiredboolPublic data associated with Acquired.

ClusterBuildArtifact

Declaration:

gox
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

FieldTypeDescription
KeystringID key.
SourceVersionstringVersion of the element.
BuildVersionstringVersion of the element.
GeneratedRelativePathstringResource route.
PluginRelativePathstringResource route.
PluginSizeint64Size in bytes.
PluginSHA256stringHash SHA-256 integrity.
ManifestRelativePathstringResource route.
ManifestSizeint64Size in bytes.
ManifestSHA256stringHash SHA-256 integrity.

ClusterBuildFailure

Declaration:

gox
type ClusterBuildFailure struct {
	Key           string
	SourceVersion string
	Code          string
	Message       string
}

ClusterBuildFailure defines a public type of API.

Fields

FieldTypeDescription
KeystringID key.
SourceVersionstringVersion of the element.
CodestringCode that classifies the state.
MessagestringA descriptive message.

ClusterBuildResultState

Declaration:

gox
type ClusterBuildResultState uint8

ClusterBuildResultState defines a public type of API.


ClusterBuildResultCompleted

Declaration:

gox
ClusterBuildResultCompleted ClusterBuildResultState = iota + 1

ClusterBuildResultCompleted defines a constant value of the API.


ClusterBuildResultFailed

Declaration:

gox
ClusterBuildResultFailed

ClusterBuildResultFailed defines a constant value of the API.


ClusterBuildResult

Declaration:

gox
type ClusterBuildResult struct {
	State    ClusterBuildResultState
	Artifact ClusterBuildArtifact
	Failure  ClusterBuildFailure
}

ClusterBuildResult defines a public type of API.

Fields

FieldTypeDescription
StateClusterBuildResultStatePublic data associated with State.
ArtifactClusterBuildArtifactPublic data associated with Artifact.
FailureClusterBuildFailurePublic data associated with Failure.

ClusterBuildWaitRequest

Declaration:

gox
type ClusterBuildWaitRequest struct {
	Key           string
	SourceVersion string
}

ClusterBuildWaitRequest defines a public type of API.

Fields

FieldTypeDescription
KeystringID key.
SourceVersionstringVersion of the element.

ClusterGroupDirectory

Declaration:

gox
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:

gox
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:

gox
type ClusterSocketRecord struct {
	ID         string
	SessionID  string
	InstanceID string
}

ClusterSocketRecord defines a public type of API.

Fields

FieldTypeDescription
IDstringUnique identifier.
SessionIDstringAssociated identifier.
InstanceIDstringAssociated identifier.

ClusterSocketDirectory

Declaration:

gox
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.


See also

Next step

Continue with API of the test package.

test package