123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- package store
- import "github.com/docker/swarmkit/api"
- // By is an interface type passed to Find methods. Implementations must be
- // defined in this package.
- type By interface {
- // isBy allows this interface to only be satisfied by certain internal
- // types.
- isBy()
- }
- type byAll struct{}
- func (a byAll) isBy() {
- }
- // All is an argument that can be passed to find to list all items in the
- // set.
- var All byAll
- type byNamePrefix string
- func (b byNamePrefix) isBy() {
- }
- // ByNamePrefix creates an object to pass to Find to select by query.
- func ByNamePrefix(namePrefix string) By {
- return byNamePrefix(namePrefix)
- }
- type byIDPrefix string
- func (b byIDPrefix) isBy() {
- }
- // ByIDPrefix creates an object to pass to Find to select by query.
- func ByIDPrefix(idPrefix string) By {
- return byIDPrefix(idPrefix)
- }
- type byName string
- func (b byName) isBy() {
- }
- // ByName creates an object to pass to Find to select by name.
- func ByName(name string) By {
- return byName(name)
- }
- type byService string
- func (b byService) isBy() {
- }
- type byRuntime string
- func (b byRuntime) isBy() {
- }
- // ByRuntime creates an object to pass to Find to select by runtime.
- func ByRuntime(runtime string) By {
- return byRuntime(runtime)
- }
- // ByServiceID creates an object to pass to Find to select by service.
- func ByServiceID(serviceID string) By {
- return byService(serviceID)
- }
- type byNode string
- func (b byNode) isBy() {
- }
- // ByNodeID creates an object to pass to Find to select by node.
- func ByNodeID(nodeID string) By {
- return byNode(nodeID)
- }
- type bySlot struct {
- serviceID string
- slot uint64
- }
- func (b bySlot) isBy() {
- }
- // BySlot creates an object to pass to Find to select by slot.
- func BySlot(serviceID string, slot uint64) By {
- return bySlot{serviceID: serviceID, slot: slot}
- }
- type byDesiredState api.TaskState
- func (b byDesiredState) isBy() {
- }
- // ByDesiredState creates an object to pass to Find to select by desired state.
- func ByDesiredState(state api.TaskState) By {
- return byDesiredState(state)
- }
- type byTaskState api.TaskState
- func (b byTaskState) isBy() {
- }
- // ByTaskState creates an object to pass to Find to select by task state.
- func ByTaskState(state api.TaskState) By {
- return byTaskState(state)
- }
- type byRole api.NodeRole
- func (b byRole) isBy() {
- }
- // ByRole creates an object to pass to Find to select by role.
- func ByRole(role api.NodeRole) By {
- return byRole(role)
- }
- type byMembership api.NodeSpec_Membership
- func (b byMembership) isBy() {
- }
- // ByMembership creates an object to pass to Find to select by Membership.
- func ByMembership(membership api.NodeSpec_Membership) By {
- return byMembership(membership)
- }
- type byReferencedNetworkID string
- func (b byReferencedNetworkID) isBy() {
- }
- // ByReferencedNetworkID creates an object to pass to Find to search for a
- // service or task that references a network with the given ID.
- func ByReferencedNetworkID(networkID string) By {
- return byReferencedNetworkID(networkID)
- }
- type byReferencedSecretID string
- func (b byReferencedSecretID) isBy() {
- }
- // ByReferencedSecretID creates an object to pass to Find to search for a
- // service or task that references a secret with the given ID.
- func ByReferencedSecretID(secretID string) By {
- return byReferencedSecretID(secretID)
- }
- type byReferencedConfigID string
- func (b byReferencedConfigID) isBy() {
- }
- // ByReferencedConfigID creates an object to pass to Find to search for a
- // service or task that references a config with the given ID.
- func ByReferencedConfigID(configID string) By {
- return byReferencedConfigID(configID)
- }
- type byKind string
- func (b byKind) isBy() {
- }
- // ByKind creates an object to pass to Find to search for a Resource of a
- // particular kind.
- func ByKind(kind string) By {
- return byKind(kind)
- }
- type byCustom struct {
- objType string
- index string
- value string
- }
- func (b byCustom) isBy() {
- }
- // ByCustom creates an object to pass to Find to search a custom index.
- func ByCustom(objType, index, value string) By {
- return byCustom{
- objType: objType,
- index: index,
- value: value,
- }
- }
- type byCustomPrefix struct {
- objType string
- index string
- value string
- }
- func (b byCustomPrefix) isBy() {
- }
- // ByCustomPrefix creates an object to pass to Find to search a custom index by
- // a value prefix.
- func ByCustomPrefix(objType, index, value string) By {
- return byCustomPrefix{
- objType: objType,
- index: index,
- value: value,
- }
- }
|