Documentation
¶
Index ¶
- type Bucket
- func (rb *Bucket) AddEvent(event *Event)
- func (rb *Bucket) CanFlush() bool
- func (rb *Bucket) CanFlushIn() time.Duration
- func (z *Bucket) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Bucket) EncodeMsg(en *msgp.Writer) (err error)
- func (z *Bucket) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Bucket) Msgsize() (s int)
- func (rb *Bucket) Post() error
- func (z *Bucket) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Event
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
Rule rules.Rule `json:"rule"`
Events []*Event `json:"events"`
FlushLock bool `json:"flush_lock"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
// contains filtered or unexported fields
}
Bucket contains the rule for a collection of events and the events
func (*Bucket) CanFlushIn ¶
CanFlushIn returns time left for flush
func (*Bucket) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (*Bucket) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
type Event ¶
type Event struct {
// Type of occurrence which has happened. Often this property is
// used for routing, observability, policy enforcement, etc.
// REQUIRED.
EventType string `json:"eventType"`
// The version of the eventType. This enables the interpretation of
// data by eventual consumers, requires the consumer to be knowledgeable
// about the producer.
// OPTIONAL.
EventTypeVersion string `json:"eventTypeVersion,omitempty"`
// The version of the CloudEvents specification which the event
// uses. This enables the interpretation of the context.
// REQUIRED.
CloudEventsVersion string `json:"cloudEventsVersion"`
// This describes the event producer. Often this will include information
// such as the type of the event source, the organization publishing the
// event, and some unique idenfitiers. The exact syntax and semantics behind
// the data encoded in the URI is event producer defined.
// REQUIRED.
Source string `json:"source"`
// ID of the event. The semantics of this string are explicitly undefined to
// ease the implementation of producers. Enables deduplication.
// REQUIRED.
EventID string `json:"eventID"`
// Timestamp of when the event happened. RFC3339.
// OPTIONAL.
EventTime time.Time `json:"eventTime,omitempty"`
// A link to the schema that the data attribute adheres to. RFC3986.
// OPTIONAL.
SchemaURL string `json:"schemaURL,omitempty"`
// Describe the data encoding format. RFC2046.
// OPTIONAL.
ContentType string `json:"contentType,omitempty"`
// This is for additional metadata and this does not have a mandated
// structure. This enables a place for custom fields a producer or middleware
// might want to include and provides a place to test metadata before adding
// them to the CloudEvents specification. See the Extensions document for a
// list of possible properties.
// OPTIONAL. This is a map, but an 'interface{}' for flexibility.
Extensions interface{} `json:"extensions,omitempty"`
// The event payload. The payload depends on the eventType, schemaURL and
// eventTypeVersion, the payload is encoded into a media format which is
// specified by the contentType attribute (e.g. application/json).
//
// If the contentType value is "application/json", or any media type with a
// structured +json suffix, the implementation MUST translate the data attribute
// value into a JSON value, and set the data member of the envelope JSON object
// to this JSON value.
// OPTIONAL.
Data interface{} `json:"data,omitempty"`
// contains filtered or unexported fields
}
Event wraps cloudevent.CloudEvent
func (*Event) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
Click to show internal directories.
Click to hide internal directories.