Documentation ¶
Index ¶
- Constants
- type Building
- type BuildingRegister
- type Callback
- type Grain
- func (g *Grain) Decode(b []byte) error
- func (g *Grain) Describe(_ *protobuf.DescribeInventoryRequest, ctx cluster.GrainContext) (*protobuf.DescribeInventoryResponse, error)
- func (g *Grain) Encode() ([]byte, error)
- func (g *Grain) Identity() string
- func (g *Grain) Init(ctx cluster.GrainContext)
- func (g *Grain) Kind() string
- func (g *Grain) ReceiveDefault(ctx cluster.GrainContext)
- func (g *Grain) Reserve(req *protobuf.ReserveRequest, ctx cluster.GrainContext) (*protobuf.ReserveResponse, error)
- func (g *Grain) Restore(req *protobuf.RestoreRequest, ctx cluster.GrainContext) (*protobuf.RestoreResponse, error)
- func (g *Grain) Start(req *protobuf.StartRequest, ctx cluster.GrainContext) (*protobuf.StartResponse, error)
- func (g *Grain) Terminate(ctx cluster.GrainContext)
- type InsufficientResourceError
- type InvalidResourceError
- type ReservedResource
- type ResourceRegister
Constants ¶
View Source
const ( CallbackBuildings = "buildings" CallbackGenerators = "generators" CallbackTransformers = "transformers" KeyBuilding = "building" KeyDisableGenerators = "disable_generators" KeyResource = "resource" KeyAmount = "amount" StateQueued = "queued" StateInactive = "inactive" StateActive = "active" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildingRegister ¶
type BuildingRegister struct { Name common.BuildingName Completed []Building Queue []Building // contains filtered or unexported fields }
type Callback ¶ added in v0.2.0
type Callback struct { Name string Subject string Method func(*protobuf.TimerFired) }
type Grain ¶
type Grain struct {
// contains filtered or unexported fields
}
func (*Grain) Describe ¶
func (g *Grain) Describe(_ *protobuf.DescribeInventoryRequest, ctx cluster.GrainContext) (*protobuf.DescribeInventoryResponse, error)
func (*Grain) Init ¶
func (g *Grain) Init(ctx cluster.GrainContext)
func (*Grain) ReceiveDefault ¶
func (g *Grain) ReceiveDefault(ctx cluster.GrainContext)
func (*Grain) Reserve ¶ added in v0.2.0
func (g *Grain) Reserve(req *protobuf.ReserveRequest, ctx cluster.GrainContext) (*protobuf.ReserveResponse, error)
func (*Grain) Restore ¶
func (g *Grain) Restore(req *protobuf.RestoreRequest, ctx cluster.GrainContext) (*protobuf.RestoreResponse, error)
func (*Grain) Start ¶
func (g *Grain) Start(req *protobuf.StartRequest, ctx cluster.GrainContext) (*protobuf.StartResponse, error)
func (*Grain) Terminate ¶
func (g *Grain) Terminate(ctx cluster.GrainContext)
type InsufficientResourceError ¶ added in v0.2.0
type InsufficientResourceError struct {
Resource common.ResourceName
}
func (InsufficientResourceError) Error ¶ added in v0.2.0
func (e InsufficientResourceError) Error() string
type InvalidResourceError ¶ added in v0.2.0
type InvalidResourceError struct {
Resource common.ResourceName
}
func (InvalidResourceError) Error ¶ added in v0.2.0
func (e InvalidResourceError) Error() string
type ReservedResource ¶ added in v0.2.0
type ResourceRegister ¶
type ResourceRegister struct { Name common.ResourceName CapFormula string Cap int Amount int Reserved int // contains filtered or unexported fields }
func (*ResourceRegister) Update ¶
func (rr *ResourceRegister) Update(amount int)
func (*ResourceRegister) UpdateCap ¶
func (rr *ResourceRegister) UpdateCap(resources map[common.ResourceName]*ResourceRegister, buildings map[common.BuildingName]*BuildingRegister) error
Click to show internal directories.
Click to hide internal directories.