Documentation
¶
Overview ¶
Package events provides data serialization for Baleen-specific events using message pack - a binary JSON compatible serialization format. Message pack is slightly larger than protocol buffers or other serialization formats but can be simpler to implement.
Index ¶
- Constants
- func Marshal(event TypedEvent, uuid string) (msg *message.Message, err error)
- type Document
- func (z *Document) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Document) EncodeMsg(en *msgp.Writer) (err error)
- func (z *Document) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Document) Msgsize() (s int)
- func (Document) Type() *api.Type
- func (z *Document) UnmarshalMsg(bts []byte) (o []byte, err error)
- type FeedItem
- func (z *FeedItem) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *FeedItem) EncodeMsg(en *msgp.Writer) (err error)
- func (z *FeedItem) MarshalMsg(b []byte) (o []byte, err error)
- func (z *FeedItem) Msgsize() (s int)
- func (FeedItem) Type() *api.Type
- func (z *FeedItem) UnmarshalMsg(bts []byte) (o []byte, err error)
- type FeedSync
- func (z *FeedSync) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *FeedSync) EncodeMsg(en *msgp.Writer) (err error)
- func (z *FeedSync) MarshalMsg(b []byte) (o []byte, err error)
- func (z *FeedSync) Msgsize() (s int)
- func (FeedSync) Type() *api.Type
- func (z *FeedSync) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Subscription
- func (z *Subscription) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Subscription) EncodeMsg(en *msgp.Writer) (err error)
- func (z *Subscription) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Subscription) Msgsize() (s int)
- func (Subscription) Type() *api.Type
- func (z *Subscription) UnmarshalMsg(bts []byte) (o []byte, err error)
- type TypedEvent
Constants ¶
const ( TypeSubscription = "Subscription" TypeFeedSync = "FeedSync" TypeFeedItem = "FeedItem" TypeDocument = "Document" )
Types specifies the event types for Ensign
const ( VersionSubscription = "1.0.0" VersionFeedSync = "1.0.0" VersionFeedItem = "1.0.0" VersionDocument = "1.0.0" )
Versions specifies the semantic version for each event type
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Document ¶
type Document struct {
ETag string `msg:"etag,omitempty"`
LastModified string `msg:"last_modified,omitempty"`
Active bool `msg:"active"`
StatusCode int `msg:"status_code,omitempty"`
Error string `msg:"error,omitempty"`
FetchedAt time.Time `msg:"fetched_at"`
FeedID string `msg:"feed_id"`
Language string `msg:"language"`
Year int `msg:"year"`
Month string `msg:"month"`
Day int `msg:"day"`
Title string `msg:"title"`
Description string `msg:"description"`
Content []byte `msg:"content"`
Encoding string `msg:"encoding"`
Link string `msg:"link"`
}
func (*Document) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type FeedItem ¶
type FeedItem struct {
FeedID string `msg:"feed_id"`
Title string `msg:"title"`
Description string `msg:"description"`
Content string `msg:"content"`
Link string `msg:"link"`
Updated string `msg:"updated"`
Published string `msg:"published"`
GUID string `msg:"guid"`
Authors []string `msg:"authors"`
Image string `msg:"image"`
Categories []string `msg:"categories"`
Enclosures []string `msg:"enclosures"`
}
func (*FeedItem) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type FeedSync ¶
type FeedSync struct {
FeedID string `msg:"feed_id"`
ETag string `msg:"etag"`
LastModified string `msg:"last_modified"`
Active bool `msg:"active"`
StatusCode int `msg:"status_code"`
Error string `msg:"error"`
SyncedAt time.Time `msg:"synced_at"`
FeedItems int64 `msg:"feed_items"`
Title string `msg:"title"`
Description string `msg:"description"`
Link string `msg:"link"`
Links []string `msg:"links"`
FeedLink string `msg:"feed_link"`
Updated string `msg:"updated"`
Published string `msg:"published"`
Language string `msg:"language"`
Copyright string `msg:"copyright"`
Generator string `msg:"generator"`
Categories []string `msg:"categories"`
FeedType string `msg:"feed_type"`
FeedVersion string `msg:"feed_version"`
}
func (*FeedSync) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type Subscription ¶
type Subscription struct {
FeedID string `msg:"feed_id,omitempty"` // a unique ID for the feed (optional)
Title string `msg:"title"` // the title of the subscription
FeedType string `msg:"feed_type"` // either rss or atom
FeedURL string `msg:"feed_url"` // the url to the feed (xmlURL in OPML)
SiteURL string `msg:"site_url"` // the url to the site (htmlURL in OPML)
}
func UnmarshalSubscription ¶
func UnmarshalSubscription(msg *message.Message) (e *Subscription, err error)
func (*Subscription) DecodeMsg ¶
func (z *Subscription) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*Subscription) EncodeMsg ¶
func (z *Subscription) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*Subscription) MarshalMsg ¶
func (z *Subscription) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*Subscription) Msgsize ¶
func (z *Subscription) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (Subscription) Type ¶
func (Subscription) Type() *api.Type
func (*Subscription) UnmarshalMsg ¶
func (z *Subscription) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type TypedEvent ¶
TypedEvents can return their type for Ensign serialization