Documentation ¶
Index ¶
- func CanPublishEventAPI(auth EventAPIAuthorization, customerID string, event ModelSendEvent) bool
- func CanSubscribeEventAPI(auth EventAPIAuthorization, customerID string, headers map[string]string, ...) bool
- type CleanupPolicy
- type EventAPI
- type EventAPIAuthorization
- type EventAPIConfig
- type EventAPIPublish
- type EventAPISubscribe
- type Model
- type ModelMaterializeConfig
- type ModelNameType
- type ModelReceiveEvent
- type ModelSendEvent
- type ModelTopicConfig
- type StreamedModel
- type TopicNameType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanPublishEventAPI ¶
func CanPublishEventAPI(auth EventAPIAuthorization, customerID string, event ModelSendEvent) bool
CanPublishEventAPI returns true if the event can be published for a given customerID and authorization
func CanSubscribeEventAPI ¶
func CanSubscribeEventAPI(auth EventAPIAuthorization, customerID string, headers map[string]string, event ModelReceiveEvent) bool
CanSubscribeEventAPI returns true if the subscription can be sent
Types ¶
type CleanupPolicy ¶
type CleanupPolicy string
CleanupPolicy is the constant for cleanup policies supported on the topic
const ( // DeleteCleanupPolicy will delete records older than Retention DeleteCleanupPolicy CleanupPolicy = "delete" // CompactCleanupPolicy will compact records older than Retention CompactCleanupPolicy CleanupPolicy = "compact" // DefaultCleanupPolicy is the default policy which is CompactCleanupPolicy DefaultCleanupPolicy CleanupPolicy = CompactCleanupPolicy )
type EventAPI ¶
type EventAPI interface { // GetEventAPIConfig returns the EventAPIConfig GetEventAPIConfig() EventAPIConfig }
EventAPI is an interface that models can implement if they have event api config
type EventAPIAuthorization ¶
type EventAPIAuthorization int
EventAPIAuthorization is a type for defining the authorization level
const ( // EventAPIAuthorizationNone is a public (not apikey or shared secret) EventAPIAuthorizationNone EventAPIAuthorization = iota // EventAPIAuthorizationNone is an internal service-to-service authorization EventAPIAuthorizationInternal // EventAPIAuthorizationAPIKey is an external api key authorization EventAPIAuthorizationAPIKey )
type EventAPIConfig ¶
type EventAPIConfig struct { Publish EventAPIPublish Subscribe EventAPISubscribe }
EventAPIConfig contains the configure for both publish and subscribe
type EventAPIPublish ¶
type EventAPIPublish struct {
Public bool
}
EventAPIPublish has details about what the publish rules are for event api
type EventAPISubscribe ¶
EventAPISubscribe has details about what the subscribe rules are for event api
type Model ¶
type Model interface { // Clone returns an exact copy of the model Clone() Model // Anon returns the model with the sensitive fields anonymized Anon() Model // GetID returns the ID for the instance GetID() string // Stringfy converts the instance to JSON string Stringify() string // ToMap converts the instance to a map ToMap() map[string]interface{} // FromMap sets the properties of the instance from the map FromMap(kv map[string]interface{}) // GetModelName returns the name of the model GetModelName() ModelNameType // IsMaterialized returns true if the model is materialized IsMaterialized() bool // IsMutable returns true if the model is mutable IsMutable() bool // GetModelMaterializeConfig returns the materialization config if materialized or nil if not GetModelMaterializeConfig() *ModelMaterializeConfig // IsEvented returns true if the model supports eventing and implements ModelEventProvider IsEvented() bool // GetTopicName returns the name of the topic if evented or nil if not GetTopicName() TopicNameType // GetTopicConfig returns the topic config object GetTopicConfig() *ModelTopicConfig // GetTopicKey returns the topic message key when sending this model as a ModelSendEvent GetTopicKey() string // GetStreamName returns the name of the stream if evented or "" if not GetStreamName() string // GetTableName returns the name of the table if evented or "" if not GetTableName() string // GetTimestamp returns the timestamp for the model or now if not provided GetTimestamp() time.Time }
Model is a generic model interface that all our models implement
type ModelMaterializeConfig ¶
type ModelMaterializeConfig struct { // KeyName is the name of the key field KeyName string // TableName is the name of the table to materialize TableName string // IdleTime returns the idle time before committing the data IdleTime time.Duration // BatchSize returns the number of records to batch before materializing BatchSize int }
ModelMaterializeConfig is a configuration for the materialization
type ModelNameType ¶
type ModelNameType string
ModelNameType is a type for the model name
func (ModelNameType) String ¶
func (t ModelNameType) String() string
String returns the value as a string
type ModelReceiveEvent ¶
type ModelReceiveEvent interface { // Object returns an instance of the Model that was received Object() StreamedModel // Message returns the underlying message data for the event Message() eventing.Message // EOF returns true if an EOF event was received. in this case, the Object and Message will return nil EOF() bool }
ModelReceiveEvent is a model event received on an event consumer channel
func NewModelReceiveEvent ¶
func NewModelReceiveEvent(msg eventing.Message, obj StreamedModel) ModelReceiveEvent
NewModelReceiveEvent returns a new ModelReceiveEvent
func NewModelReceiveEventEOF ¶
func NewModelReceiveEventEOF(msg eventing.Message) ModelReceiveEvent
NewModelReceiveEventEOF creates a model receive event that signals an EOF on the topic
type ModelSendEvent ¶
type ModelSendEvent interface { // Key is the key to use for the message Key() string // Object returns an instance of the Model that will be send Object() StreamedModel // Headers returns any headers for the event. can be nil to not send any additional headers Headers() map[string]string // Timestamp returns the event timestamp. If empty, will default to time.Now() Timestamp() time.Time }
ModelSendEvent is a model event to send on an event producer channel
func NewModelSendEvent ¶
func NewModelSendEvent(object StreamedModel) ModelSendEvent
NewModelSendEvent will send just a model object
func NewModelSendEventWithHeaders ¶
func NewModelSendEventWithHeaders(object StreamedModel, headers map[string]string) ModelSendEvent
NewModelSendEvent will send just a model object and headers
type ModelTopicConfig ¶
type ModelTopicConfig struct { // NumPartitions returns the number of partitions for the topic NumPartitions int // ReplicationFactor returns the replication factor for the topic ReplicationFactor int // Retention returns the retention duration for items in the topic Retention time.Duration // MaxSize in bytes for items in the topic MaxSize int64 // Key is the message key field for the topic Key string // Timestamp is the timestamp field for the topic Timestamp string // TTL is the duration the message is valid TTL time.Duration // CleanupPolicy is the policy for how to deal with older records CleanupPolicy CleanupPolicy }
ModelTopicConfig is a configuration for the topic
type StreamedModel ¶
type StreamedModel interface { // FIXME: re-breakout the model (public) from stream model (private) once things settle Model }
StreamedModel is a model that is streamed
type TopicNameType ¶
type TopicNameType string
TopicNameType is a type for the name of a topic
func (TopicNameType) String ¶
func (t TopicNameType) String() string
String returns the value as a string