Documentation ¶
Index ¶
- Variables
- type BasicPlugin
- func (bp *BasicPlugin) AddRngUsed(ri *sgc7utils.RngInfo)
- func (bp *BasicPlugin) ClearCache()
- func (bp *BasicPlugin) ClearUsedRngs()
- func (bp *BasicPlugin) GetUsedRngs() []*sgc7utils.RngInfo
- func (bp *BasicPlugin) Init()
- func (bp *BasicPlugin) Random(ctx context.Context, r int) (int, error)
- func (bp *BasicPlugin) RollbackUsedRngs() error
- func (bp *BasicPlugin) SetCache(arr []int)
- func (bp *BasicPlugin) TagUsedRngs()
- type FuncNewPlugin
- type IPlugin
- type PluginsMgr
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidTag - invalid tag ErrInvalidTag = errors.New("invalid tag") )
Functions ¶
This section is empty.
Types ¶
type BasicPlugin ¶
BasicPlugin - basic plugin
func (*BasicPlugin) AddRngUsed ¶
func (bp *BasicPlugin) AddRngUsed(ri *sgc7utils.RngInfo)
AddRngUsed - added used rngs
func (*BasicPlugin) ClearUsedRngs ¶
func (bp *BasicPlugin) ClearUsedRngs()
ClearUsedRngs - clear used rngs
func (*BasicPlugin) GetUsedRngs ¶
func (bp *BasicPlugin) GetUsedRngs() []*sgc7utils.RngInfo
GetUsedRngs - get used rngs
func (*BasicPlugin) RollbackUsedRngs ¶
func (bp *BasicPlugin) RollbackUsedRngs() error
RollbackUsedRngs - rollback UsedRngs with a tag
func (*BasicPlugin) TagUsedRngs ¶
func (bp *BasicPlugin) TagUsedRngs()
TagUsedRngs - new a tag for current UsedRngs
type IPlugin ¶
type IPlugin interface { // Random - return [0, r) Random(ctx context.Context, r int) (int, error) // GetUsedRngs - get used rngs GetUsedRngs() []*sgc7utils.RngInfo // ClearUsedRngs - clear used rngs ClearUsedRngs() // TagUsedRngs - new a tag for current UsedRngs TagUsedRngs() // RollbackUsedRngs - rollback UsedRngs with the latest tag RollbackUsedRngs() error // SetCache - set cache SetCache(arr []int) // ClearCache - clear cached rngs ClearCache() // Init - initial Init() }
IPlugin - plugin
type PluginsMgr ¶
type PluginsMgr struct {
// contains filtered or unexported fields
}
PluginsMgr - plugins manager
func NewPluginsMgr ¶
func NewPluginsMgr(funcNewPlugin FuncNewPlugin) *PluginsMgr
NewPluginsMgr - new a PluginsMgr
func (*PluginsMgr) FreePlugin ¶
func (mgr *PluginsMgr) FreePlugin(plugin IPlugin)
FreePlugin - free a Plugin
Click to show internal directories.
Click to hide internal directories.