traits

package
Version: v0.0.0-...-48fa796 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	Kinded
	Named
	Meta
}

Base contains all the minimum necessary structs to build a resource. It should be used as a starting point to avoid re-implementing the straightforward methods.

func (*Base) String

func (obj *Base) String() string

String returns a string representation of a resource.

type Edgeable

type Edgeable struct {
	// Xmeta is the stored meta. It should be called `meta` but it must be
	// public so that the `encoding/gob` package can encode it properly.
	Xmeta *engine.AutoEdgeMeta

	// Bug5819 works around issue https://github.com/golang/go/issues/5819
	Bug5819 interface{} // XXX: workaround
}

Edgeable contains a general implementation with some of the properties and methods needed to support autoedges on resources. It may be used as a start point to avoid re-implementing the straightforward methods.

func (*Edgeable) AutoEdgeMeta

func (obj *Edgeable) AutoEdgeMeta() *engine.AutoEdgeMeta

AutoEdgeMeta lets you get or set meta params for the automatic edges trait.

func (*Edgeable) SetAutoEdgeMeta

func (obj *Edgeable) SetAutoEdgeMeta(meta *engine.AutoEdgeMeta)

SetAutoEdgeMeta lets you set all of the meta params for the automatic edges trait in a single call.

type GraphQueryable

type GraphQueryable struct {

	// Bug5819 works around issue https://github.com/golang/go/issues/5819
	Bug5819 interface{} // XXX: workaround
}

GraphQueryable contains a general implementation with some of the properties and methods needed to implement the graph query permission for resources.

func (*GraphQueryable) GraphQueryAllowed

func (obj *GraphQueryable) GraphQueryAllowed(opts ...engine.GraphQueryableOption) error

GraphQueryAllowed returns nil if you're allowed to query the graph. This function accepts information about the requesting resource so we can determine the access with some form of fine-grained control.

type Groupable

type Groupable struct {
	// Xmeta is the stored meta. It should be called `meta` but it must be
	// public so that the `encoding/gob` package can encode it properly.
	Xmeta *engine.AutoGroupMeta

	// Bug5819 works around issue https://github.com/golang/go/issues/5819
	Bug5819 interface{} // XXX: workaround
	// contains filtered or unexported fields
}

Groupable contains a general implementation with most of the properties and methods needed to support autogrouping on resources. It may be used as a starting point to avoid re-implementing the straightforward methods.

func (*Groupable) AutoGroupMeta

func (obj *Groupable) AutoGroupMeta() *engine.AutoGroupMeta

AutoGroupMeta lets you get or set meta params for the automatic grouping trait.

func (*Groupable) GetGroup

func (obj *Groupable) GetGroup() []engine.GroupableRes

GetGroup returns everyone grouped inside me.

func (*Groupable) GroupCmp

func (obj *Groupable) GroupCmp(res engine.GroupableRes) error

GroupCmp compares two resources and decides if they're suitable for grouping. You'll probably want to override this method when implementing a resource... This base implementation assumes not, so override me!

func (*Groupable) GroupRes

func (obj *Groupable) GroupRes(res engine.GroupableRes) error

GroupRes groups resource argument (res) into self.

func (*Groupable) IsGrouped

func (obj *Groupable) IsGrouped() bool

IsGrouped determines if we are grouped.

func (*Groupable) SetAutoGroupMeta

func (obj *Groupable) SetAutoGroupMeta(meta *engine.AutoGroupMeta)

SetAutoGroupMeta lets you set all of the meta params for the automatic grouping trait in a single call.

func (*Groupable) SetGroup

func (obj *Groupable) SetGroup(grouped []engine.GroupableRes)

SetGroup sets the grouped resources into me.

func (*Groupable) SetGrouped

func (obj *Groupable) SetGrouped(b bool)

SetGrouped sets a flag to tell if we are grouped.

type Kinded

type Kinded struct {
	// Xkind is the stored kind. It should be called `kind` but it must be
	// public so that the `encoding/gob` package can encode it properly.
	Xkind string

	// Bug5819 works around issue https://github.com/golang/go/issues/5819
	Bug5819 interface{} // XXX: workaround
}

Kinded contains a general implementation of the properties and methods needed to support the resource kind. It should be used as a starting point to avoid re-implementing the straightforward kind methods.

func (*Kinded) Kind

func (obj *Kinded) Kind() string

Kind returns the string representation for the kind this resource is.

func (*Kinded) SetKind

func (obj *Kinded) SetKind(kind string)

SetKind sets the kind string for this resource. It must only be set by the engine.

type Meta

type Meta struct {
	// Xmeta is the stored meta. It should be called `meta` but it must be
	// public so that the `encoding/gob` package can encode it properly.
	Xmeta *engine.MetaParams

	// Bug5819 works around issue https://github.com/golang/go/issues/5819
	Bug5819 interface{} // XXX: workaround
}

Meta contains a general implementation of the properties and methods needed to support meta parameters. It should be used as a starting point to avoid re-implementing the straightforward meta methods.

func (*Meta) MetaParams

func (obj *Meta) MetaParams() *engine.MetaParams

MetaParams lets you get or set meta params for this trait.

func (*Meta) SetMetaParams

func (obj *Meta) SetMetaParams(meta *engine.MetaParams)

SetMetaParams lets you set all of the meta params for the resource in a single call.

type Named

type Named struct {
	// Xname is the stored name. It should be called `name` but it must be
	// public so that the `encoding/gob` package can encode it properly.
	Xname string

	// Bug5819 works around issue https://github.com/golang/go/issues/5819
	Bug5819 interface{} // XXX: workaround
}

Named contains a general implementation of the properties and methods needed to support named resources. It should be used as a starting point to avoid re-implementing the straightforward name methods.

func (*Named) Name

func (obj *Named) Name() string

Name returns the unique name this resource has. It is only unique within its own kind.

func (*Named) SetName

func (obj *Named) SetName(name string)

SetName sets the unique name for this resource. It must only be unique within its own kind.

type Recvable

type Recvable struct {

	// Bug5819 works around issue https://github.com/golang/go/issues/5819
	Bug5819 interface{} // XXX: workaround
	// contains filtered or unexported fields
}

Recvable contains a general implementation with some of the properties and methods needed to implement receiving from resources.

func (*Recvable) Recv

func (obj *Recvable) Recv() map[string]*engine.Send

Recv is used to get information that was passed in. This data can then be used to run the Send/Recv data transfer.

func (*Recvable) SetRecv

func (obj *Recvable) SetRecv(recv map[string]*engine.Send)

SetRecv is used to inject incoming values into the resource.

type Refreshable

type Refreshable struct {

	// Bug5819 works around issue https://github.com/golang/go/issues/5819
	Bug5819 interface{} // XXX: workaround
	// contains filtered or unexported fields
}

Refreshable functions as flag storage for resources to signal that they support receiving refresh notifications, and what that value is. These are commonly used to send information that some aspect of the state is invalid due to an unlinked change. The canonical example is a svc resource that needs reloading after a configuration file changes.

func (*Refreshable) Refresh

func (obj *Refreshable) Refresh() bool

Refresh returns the refresh notification state.

func (*Refreshable) SetRefresh

func (obj *Refreshable) SetRefresh(b bool)

SetRefresh sets the refresh notification state.

type Reversible

type Reversible struct {
	// Xmeta is the stored meta. It should be called `meta` but it must be
	// public so that the `encoding/gob` package can encode it properly.
	Xmeta *engine.ReversibleMeta

	// Bug5819 works around issue https://github.com/golang/go/issues/5819
	Bug5819 interface{} // XXX: workaround
}

Reversible contains a general implementation with most of the properties and methods needed to support reversing resources. It may be used as a starting point to avoid re-implementing the straightforward methods.

func (*Reversible) ReversibleMeta

func (obj *Reversible) ReversibleMeta() *engine.ReversibleMeta

ReversibleMeta lets you get or set meta params for the reversing trait.

func (*Reversible) SetReversibleMeta

func (obj *Reversible) SetReversibleMeta(meta *engine.ReversibleMeta)

SetReversibleMeta lets you set all of the meta params for the reversing trait in a single call.

type Sendable

type Sendable struct {

	// Bug5819 works around issue https://github.com/golang/go/issues/5819
	Bug5819 interface{} // XXX: workaround
	// contains filtered or unexported fields
}

Sendable contains a general implementation with some of the properties and methods needed to implement sending from resources. You'll need to implement the Sends method, and call the Send method in CheckApply via the Init API.

func (*Sendable) Send

func (obj *Sendable) Send(st interface{}) error

Send is used to send a struct in CheckApply. This is typically wrapped in the resource API and consumed that way.

func (*Sendable) Sends

func (obj *Sendable) Sends() interface{}

Sends returns a struct containing the defaults of the type we send. This needs to be implemented (overridden) by the struct with the Sendable trait to be able to send any values. The field struct tag names are the keys used.

func (*Sendable) Sent

func (obj *Sendable) Sent() interface{}

Sent returns the struct of values that have been sent by this resource.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL