Documentation
¶
Index ¶
Constants ¶
View Source
const ( // PENDING status for bonded atom electron running instance PENDING int = iota // PROCESSING status for bonded atom electron running instance PROCESSING // COMPLETED status for bonded atom electron running instance COMPLETED )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Atom ¶
type Atom interface {
ID() string
Process(ctx context.Context, electron Electron, outbound chan<- Electron) (result <-chan []byte, err <-chan error)
}
Atom is an atomic action with process method for the atomizer to execute the Atom
type Atomizer ¶
type Atomizer interface {
Exec() error
Register(value interface{}) error
Errors(buffer int) (<-chan error, error)
Properties(buffer int) (<-chan Properties, error)
Validate() bool
}
Atomizer interface implementation
type Conductor ¶
type Conductor interface {
// ID returns the unique name of the conductor
ID() string
// Receive gets the atoms from the source that are available to atomize
Receive() <-chan Electron
// Complete mark the completion of an electron instance with applicable statistics
Complete(properties Properties)
// Send sends electrons back out through the conductor for additional processing
Send(electron Electron) (result <-chan []byte)
// Validate ensure the conductor is valid
Validate() (valid bool)
}
Conductor is the interface that should be implemented for passing electrons to the atomizer that need processing. This should generally be registered with the atomizer in an initialization script
type Electron ¶
type Electron interface {
Atom() (ID string)
ID() (ID string)
Payload() (payload []byte)
Timeout() (timeout *time.Duration)
Validate() (valid bool)
// Callback allows the system to return results of a spawned electron to the caller after it's been bonded
// TODO: Need to set it up so that an atom can communicate with the original source by sending messages through a channel which takes electrons
// When the electron is sent back to another node a channel is opened by the send method of the source and blocking will occur on reading from that channel
// rather than relying on a callback with a waitgroup which is less reliable
Callback(properties Properties) (err error)
}
Electron is the interface which should be implemented by the messages sent through the conductors that trigger instances of each atom for processing.
type Properties ¶
type Properties interface {
// StartTime indicates the time the processing of an atom began (UTC)
StartTime() (start time.Time)
// EndTime indicates the time the processing of an atom ended (UTC)
EndTime() (end time.Time)
// ProcessingTime returns the duration of the process method on an atom for analysis by the calling system
ProcessingTime() (ptime time.Duration)
// Status is the status of the atom at the time the processing completed
Status() (status int)
// Errors returns the list of errors that occurred on this atom after all the processing had been completed
Errors() (errors []error)
// Results returns the list of results which are also byte slices
Results() (results [][]byte)
}
Properties tracks the performance, status and errors that occur in an atom to be passed to the original requestor This should be returned to the sender over a properties channel
Source Files
¶
Click to show internal directories.
Click to hide internal directories.