Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ball ¶
type Ball struct {
// Name of the player (handler) - must
Player string `json:"Player"`
// Optional headers/meta data
Properties []Property `json:"Properties,omitempty"`
// Optional content, usually JSON byte array
Raw []byte `json:"Raw,omitempty"`
}
Main unit of information
type PingPong ¶
type PingPong interface {
// ctx used for external cancel of the 'game'.
// how to use it see:
// https://www.sohamkamani.com/golang/context/
// https://www.willem.dev/articles/context-cancellation-explained/
// https://www.willem.dev/articles/context-todo-or-background/
// If ctx is not initialized, context.Background() will be used
// cancel is valid flow, don't return error for this case
// Content of returned Ball should reflect cancellation
//
// error should be returned for the cases when continue of the game is impossible.
//
Play(ctx context.Context, b *Ball) (*Ball, error)
}
PingPong is the interface that we're exposing as a visible part of plugin.
type PingPongPlayer ¶
type PingPongPlayer interface {
// Initiation - once for lifecycle.
// Called by factory function provided by developed during creation
// config (may be empty) - usually JSON byte array with configuration.
InitOnce(config []byte) error
PingPong
// Stop processing, clean resources - once for lifecycle.
// Called by infrastructure
FinishOnce() error
}
PingPongPlayer - interface of server part
type PingPongPlayerFactory ¶
type PingPongPlayerFactory func(name string) (player PingPongPlayer, err error)
Creates PingPongPlayer implementation Calls InitOnce err is InitOnce error name converted to lower case befor call
Click to show internal directories.
Click to hide internal directories.