config

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 17 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	State_name = map[int32]string{
		0: "UNKNOWN",
		1: "READY",
	}
	State_value = map[string]int32{
		"UNKNOWN": 0,
		"READY":   1,
	}
)

Enum value maps for State.

View Source
var File_pkg_broker_config_targets_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Broker

type Broker struct {

	// The id of the object. E.g. UID of the resource.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// The name of the object.
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// The namespace of the object.
	Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"`
	// The broker address.
	// Will we have more than one address?
	Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"`
	// The decouple queue for the broker.
	DecoupleQueue *Queue `protobuf:"bytes,5,opt,name=decouple_queue,json=decoupleQueue,proto3" json:"decouple_queue,omitempty"`
	// All targets of the broker.
	Targets map[string]*Target `` /* 155-byte string literal not displayed */
	// The broker state.
	State State `protobuf:"varint,7,opt,name=state,proto3,enum=config.State" json:"state,omitempty"`
	// contains filtered or unexported fields
}

Represents a broker.

func (*Broker) Descriptor deprecated

func (*Broker) Descriptor() ([]byte, []int)

Deprecated: Use Broker.ProtoReflect.Descriptor instead.

func (*Broker) GetAddress

func (x *Broker) GetAddress() string

func (*Broker) GetDecoupleQueue

func (x *Broker) GetDecoupleQueue() *Queue

func (*Broker) GetId

func (x *Broker) GetId() string

func (*Broker) GetName

func (x *Broker) GetName() string

func (*Broker) GetNamespace

func (x *Broker) GetNamespace() string

func (*Broker) GetState

func (x *Broker) GetState() State

func (*Broker) GetTargets

func (x *Broker) GetTargets() map[string]*Target

func (*Broker) Key added in v0.15.0

func (x *Broker) Key() *BrokerKey

Key returns the BrokerKey for this Broker.

func (*Broker) ProtoMessage

func (*Broker) ProtoMessage()

func (*Broker) ProtoReflect added in v0.15.0

func (x *Broker) ProtoReflect() protoreflect.Message

func (*Broker) Reset

func (x *Broker) Reset()

func (*Broker) String

func (x *Broker) String() string

type BrokerKey

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

BrokerKey uniquely identifies a single Broker, at a given point in time.

func BrokerKeyFromPersistenceString added in v0.20.0

func BrokerKeyFromPersistenceString(s string) (*BrokerKey, error)

func KeyFromBroker added in v0.20.0

func KeyFromBroker(b *brokerv1beta1.Broker) *BrokerKey

KeyFromBroker creates a BrokerKey from a K8s Broker object.

func TestOnlyBrokerKey added in v0.20.0

func TestOnlyBrokerKey(namespace, name string) *BrokerKey

TestOnlyBrokerKey returns the key of a broker. This method exists to make tests that need a BrokerKey, but do not need an actual Broker, easier to write.

func (*BrokerKey) CreateEmptyBroker added in v0.20.0

func (k *BrokerKey) CreateEmptyBroker() *Broker

CreateEmptyBroker creates an empty Broker that corresponds to this BrokerKey. It is empty except for the portions known about by the BrokerKey.

func (*BrokerKey) MetricsResource added in v0.20.0

func (k *BrokerKey) MetricsResource() resource.Resource

MetricsResource generates the Resource object that metrics will be associated with.

func (*BrokerKey) PersistenceString added in v0.20.0

func (k *BrokerKey) PersistenceString() string

PersistenceString is the string that is persisted as the key for this Broker in the protobuf. It is stable and can only change if all existing usage locations are made backwards compatible, supporting _both_ the old and the new format, for at least one release.

func (*BrokerKey) SpanMessagingDestination added in v0.20.0

func (k *BrokerKey) SpanMessagingDestination() string

SpanMessagingDestination is the Messaging Destination of requests sent to this BrokerKey.

func (*BrokerKey) SpanMessagingDestinationAttribute added in v0.20.0

func (k *BrokerKey) SpanMessagingDestinationAttribute() trace.Attribute

SpanMessagingDestinationAttribute is the Messaging Destination attribute that should be attached to the tracing Span.

func (*BrokerKey) String added in v0.20.0

func (k *BrokerKey) String() string

String creates a human readable version of this key. It is for debug purposes only. It is free to change at any time.

type BrokerMutation

type BrokerMutation interface {
	// SetID sets the broker ID.
	SetID(id string) BrokerMutation
	// SetAddress sets the broker address.
	SetAddress(address string) BrokerMutation
	// SetDecoupleQueue sets the broker decouple queue.
	SetDecoupleQueue(q *Queue) BrokerMutation
	// SetState sets the broker state.
	SetState(s State) BrokerMutation
	// UpsertTargets upserts Targets to the broker.
	// The targets' namespace and broker will be forced to be
	// the same as the broker's namespace and name.
	UpsertTargets(...*Target) BrokerMutation
	// DeleteTargets targets deletes Targets from the broker.
	DeleteTargets(...*Target) BrokerMutation
	// Delete deletes the broker.
	Delete()
}

BrokerMutation provides functions to mutate a Broker. The changes made via the BrokerMutation must be "committed" altogether.

type CachedTargets

type CachedTargets struct {
	Value atomic.Value
}

CachedTargets provides a in-memory cached copy of targets.

func (*CachedTargets) Bytes

func (ct *CachedTargets) Bytes() ([]byte, error)

Bytes serializes all the targets.

func (*CachedTargets) DebugString added in v0.20.0

func (ct *CachedTargets) DebugString() string

DebugString returns the text format of all the targets. It is for _debug_ purposes only. The output format is not guaranteed to be stable and may change at any time.

func (*CachedTargets) GetBrokerByKey

func (ct *CachedTargets) GetBrokerByKey(key *BrokerKey) (*Broker, bool)

GetBrokerByKey returns a broker and its targets if it exists. Do not modify the returned Broker copy.

func (*CachedTargets) GetTargetByKey added in v0.15.0

func (ct *CachedTargets) GetTargetByKey(key *TargetKey) (*Target, bool)

GetTargetByKey returns a target by its trigger key. The format of trigger key is namespace/brokerName/targetName. Do not modify the returned Target copy.

func (*CachedTargets) Load

func (ct *CachedTargets) Load() *TargetsConfig

Load atomically loads a stored TargetsConfig. If there was no TargetsConfig stored, nil will be returned.

func (*CachedTargets) RangeAllTargets

func (ct *CachedTargets) RangeAllTargets(f func(*Target) bool)

RangeAllTargets ranges over all targets. Do not modify the given Target copy.

func (*CachedTargets) RangeBrokers

func (ct *CachedTargets) RangeBrokers(f func(*Broker) bool)

RangeBrokers ranges over all brokers. Do not modify the given Broker copy.

func (*CachedTargets) Store

func (ct *CachedTargets) Store(t *TargetsConfig)

Store atomically stores a TargetsConfig.

type Queue

type Queue struct {
	Topic        string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	Subscription string `protobuf:"bytes,2,opt,name=subscription,proto3" json:"subscription,omitempty"`
	State        State  `protobuf:"varint,3,opt,name=state,proto3,enum=config.State" json:"state,omitempty"`
	// contains filtered or unexported fields
}

A pubsub "queue".

func (*Queue) Descriptor deprecated

func (*Queue) Descriptor() ([]byte, []int)

Deprecated: Use Queue.ProtoReflect.Descriptor instead.

func (*Queue) GetState added in v0.16.2

func (x *Queue) GetState() State

func (*Queue) GetSubscription

func (x *Queue) GetSubscription() string

func (*Queue) GetTopic

func (x *Queue) GetTopic() string

func (*Queue) ProtoMessage

func (*Queue) ProtoMessage()

func (*Queue) ProtoReflect added in v0.15.0

func (x *Queue) ProtoReflect() protoreflect.Message

func (*Queue) Reset

func (x *Queue) Reset()

func (*Queue) String

func (x *Queue) String() string

type ReadonlyTargets

type ReadonlyTargets interface {
	// RangeAllTargets ranges over all targets.
	// Do not modify the given Target copy.
	RangeAllTargets(func(*Target) bool)
	// GetTargetByKey returns a target by its trigger key. The format of trigger key is namespace/brokerName/targetName.
	// Do not modify the returned Target copy.
	GetTargetByKey(key *TargetKey) (*Target, bool)
	// GetBrokerByKey returns a Broker and its targets, if it exists.
	// Do not modify the returned Broker copy.
	GetBrokerByKey(key *BrokerKey) (*Broker, bool)
	// RangeBrokers ranges over all brokers.
	// Do not modify the given Broker copy.
	RangeBrokers(func(*Broker) bool)
	// Bytes serializes all the targets.
	Bytes() ([]byte, error)
	// DebugString returns the text format of all the targets. It is for _debug_ purposes only. The
	// output format is not guaranteed to be stable and may change at any time.
	DebugString() string
}

ReadonlyTargets provides "read" functions for brokers and targets.

type State

type State int32

The state of the object. We may add additional intermediate states if needed.

const (
	State_UNKNOWN State = 0
	State_READY   State = 1
)

func (State) Descriptor added in v0.15.0

func (State) Descriptor() protoreflect.EnumDescriptor

func (State) Enum added in v0.15.0

func (x State) Enum() *State

func (State) EnumDescriptor deprecated

func (State) EnumDescriptor() ([]byte, []int)

Deprecated: Use State.Descriptor instead.

func (State) Number added in v0.15.0

func (x State) Number() protoreflect.EnumNumber

func (State) String

func (x State) String() string

func (State) Type added in v0.15.0

func (State) Type() protoreflect.EnumType

type Target

type Target struct {

	// The id of the object. E.g. UID of the resource.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// The name of the object.
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// The namespace of the object.
	Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"`
	// The broker name that the trigger is referencing.
	Broker string `protobuf:"bytes,4,opt,name=broker,proto3" json:"broker,omitempty"`
	// The resolved subscriber URI of the target.
	Address string `protobuf:"bytes,5,opt,name=address,proto3" json:"address,omitempty"`
	// Optional filters from the trigger.
	FilterAttributes map[string]string `` /* 197-byte string literal not displayed */
	// The retry queue for the target.
	RetryQueue *Queue `protobuf:"bytes,7,opt,name=retry_queue,json=retryQueue,proto3" json:"retry_queue,omitempty"`
	// The target state.
	State State `protobuf:"varint,8,opt,name=state,proto3,enum=config.State" json:"state,omitempty"`
	// contains filtered or unexported fields
}

Target defines the config schema for a broker subscription target.

func (*Target) Descriptor deprecated

func (*Target) Descriptor() ([]byte, []int)

Deprecated: Use Target.ProtoReflect.Descriptor instead.

func (*Target) GetAddress

func (x *Target) GetAddress() string

func (*Target) GetBroker

func (x *Target) GetBroker() string

func (*Target) GetFilterAttributes

func (x *Target) GetFilterAttributes() map[string]string

func (*Target) GetId

func (x *Target) GetId() string

func (*Target) GetName

func (x *Target) GetName() string

func (*Target) GetNamespace

func (x *Target) GetNamespace() string

func (*Target) GetRetryQueue

func (x *Target) GetRetryQueue() *Queue

func (*Target) GetState

func (x *Target) GetState() State

func (*Target) Key added in v0.15.0

func (x *Target) Key() *TargetKey

Key returns the TargetKey for this Target.

func (*Target) ProtoMessage

func (*Target) ProtoMessage()

func (*Target) ProtoReflect added in v0.15.0

func (x *Target) ProtoReflect() protoreflect.Message

func (*Target) Reset

func (x *Target) Reset()

func (*Target) String

func (x *Target) String() string

type TargetKey added in v0.20.0

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

TargetKey uniquely identifies a single Target, at a given point in time.

func (*TargetKey) ParentKey added in v0.20.0

func (k *TargetKey) ParentKey() *BrokerKey

ParentKey is the key of the parent this Target corresponds to.

func (*TargetKey) String added in v0.20.0

func (k *TargetKey) String() string

String creates a human readable version of this key. It is for debug purposes only. It is free to change at any time.

type Targets

type Targets interface {
	ReadonlyTargets
	// MutateBroker mutates a broker by namespace and name.
	// If the broker doesn't exist, it will be added (unless Delete() is called).
	MutateBroker(key *BrokerKey, mutate func(BrokerMutation))
}

Targets provides "read" and "write" functions for broker targets.

type TargetsConfig

type TargetsConfig struct {

	// Keybed by broker namespace/name.
	Brokers map[string]*Broker `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

TargetsConfig is the collection of all Targets.

func (*TargetsConfig) Descriptor deprecated

func (*TargetsConfig) Descriptor() ([]byte, []int)

Deprecated: Use TargetsConfig.ProtoReflect.Descriptor instead.

func (*TargetsConfig) GetBrokers

func (x *TargetsConfig) GetBrokers() map[string]*Broker

func (*TargetsConfig) ProtoMessage

func (*TargetsConfig) ProtoMessage()

func (*TargetsConfig) ProtoReflect added in v0.15.0

func (x *TargetsConfig) ProtoReflect() protoreflect.Message

func (*TargetsConfig) Reset

func (x *TargetsConfig) Reset()

func (*TargetsConfig) String

func (x *TargetsConfig) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL