package coretest

import "github.com/purpleidea/mgmt/lang/core/test"

Index

Constants

const (
	// OneInstanceAFuncName is the name this fact is registered as. It's
	// still a Func Name because this is the name space the fact is actually
	// using.
	OneInstanceAFuncName = "one_instance_a"

	// OneInstanceBFuncName is the name this fact is registered as. It's
	// still a Func Name because this is the name space the fact is actually
	// using.
	OneInstanceBFuncName = "one_instance_b"

	// OneInstanceCFuncName is the name this fact is registered as. It's
	// still a Func Name because this is the name space the fact is actually
	// using.
	OneInstanceCFuncName = "one_instance_c"

	// OneInstanceDFuncName is the name this fact is registered as. It's
	// still a Func Name because this is the name space the fact is actually
	// using.
	OneInstanceDFuncName = "one_instance_d"

	// OneInstanceEFuncName is the name this fact is registered as. It's
	// still a Func Name because this is the name space the fact is actually
	// using.
	OneInstanceEFuncName = "one_instance_e"

	// OneInstanceFFuncName is the name this fact is registered as. It's
	// still a Func Name because this is the name space the fact is actually
	// using.
	OneInstanceFFuncName = "one_instance_f"

	// OneInstanceGFuncName is the name this fact is registered as. It's
	// still a Func Name because this is the name space the fact is actually
	// using.
	OneInstanceGFuncName = "one_instance_g"

	// OneInstanceHFuncName is the name this fact is registered as. It's
	// still a Func Name because this is the name space the fact is actually
	// using.
	OneInstanceHFuncName = "one_instance_h"
)
const (
	// FastCountFuncName is the name this fact is registered as. It's still
	// a Func Name because this is the name space the fact is actually
	// using.
	FastCountFuncName = "fastcount"
)
const (
	// ModuleName is the prefix given to all the functions in this module.
	ModuleName = "test"
)

Types

type FastCountFact

type FastCountFact struct {
	// contains filtered or unexported fields
}

FastCountFact is a fact that counts up as fast as possible from zero forever.

func (*FastCountFact) Call

func (obj *FastCountFact) Call(ctx context.Context) (types.Value, error)

Call this fact and return the value if it is possible to do so at this time.

func (*FastCountFact) Info

func (obj *FastCountFact) Info() *facts.Info

Info returns some static info about itself.

func (*FastCountFact) Init

func (obj *FastCountFact) Init(init *facts.Init) error

Init runs some startup code for this fact.

func (*FastCountFact) Stream

func (obj *FastCountFact) Stream(ctx context.Context) error

Stream returns the changing values that this fact has over time.

func (*FastCountFact) String

func (obj *FastCountFact) String() string

String returns a simple name for this fact. This is needed so this struct can satisfy the pgraph.Vertex interface.

type OneInstanceFact

type OneInstanceFact struct {
	Name  string
	Mutex *sync.Mutex
	Flag  *bool
	// contains filtered or unexported fields
}

OneInstanceFact is a fact which flips a bool repeatedly. This is an example fact and is not meant for serious computing. This would be better served by a flip function which you could specify an interval for.

func (*OneInstanceFact) Call

func (obj *OneInstanceFact) Call(ctx context.Context) (types.Value, error)

Call this fact and return the value if it is possible to do so at this time.

func (*OneInstanceFact) Info

func (obj *OneInstanceFact) Info() *facts.Info

Info returns some static info about itself.

func (*OneInstanceFact) Init

func (obj *OneInstanceFact) Init(init *facts.Init) error

Init runs some startup code for this fact.

func (*OneInstanceFact) Stream

func (obj *OneInstanceFact) Stream(ctx context.Context) error

Stream returns the changing values that this fact has over time.

func (*OneInstanceFact) String

func (obj *OneInstanceFact) String() string

String returns a simple name for this fact. This is needed so this struct can satisfy the pgraph.Vertex interface.

Source Files

fastcount_fact.go oneinstance_fact.go test.go

Version
v0.0.0-20250322185616-c50a578426f1 (latest)
Published
Mar 22, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
4 days ago

Tools for package owners.