Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update Streaming doc comments #165

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ const (
AddEvent EventType = "add"
// UpdateEvent happens when a value in the stream's watched set changes.
UpdateEvent EventType = "update"
// Remove event happens when a value in the stream's watched set is removed.
// RemoveEvent happens when a value in the stream's watched set is removed.
RemoveEvent EventType = "remove"
// StatusEvent happens periodically and comunicates the stream's latest
// transacion time as well as ops aquired during its idle period.
// StatusEvent happens periodically and communicates the stream's latest
// transaction time as well as ops acquired during its idle period.
StatusEvent EventType = "status"
)

// Event represents a streaming event.
//
// Events of type [fauna.StatusEvent] have its [fauna.Event.Data] field set to
// nil. Other event's [fauna.Data] can be unmarshalled via the
// nil. Other event's [fauna.Data] can be unmarshaled via the
// [fauna.Event.Unmarshal] method.
type Event struct {
// Type is this event's type.
Expand All @@ -46,7 +46,7 @@ func (e *Event) Unmarshal(into any) error {
// ErrEvent contains error information present in error events.
//
// Error events with "abort" code contain its aborting value present in the
// [fauan.ErrEvent.Abort]. The aborting values can be unmarshalled with the
// [fauan.ErrEvent.Abort]. The aborting values can be unmarshaled with the
// [fauna.ErrEvent.Unmarshal] method.
type ErrEvent struct {
// Code is the error's code.
Expand Down Expand Up @@ -153,12 +153,12 @@ func (es *Events) Next(event *Event) (err error) {
es.syncTxnTime(raw.TxnTime)
err = convertRawEvent(&raw, event)
if _, ok := err.(*ErrEvent); ok {
es.Close() // no more events are comming
es.Close() // no more events are coming
}
} else if !es.closed {
// NOTE: This code tries to resume streams on network and IO errors. It
// presume that if the service is unavailable, the reconnect call will
// fail. Automatic retries and backoff mechanisms are impleneted at the
// presumes that if the service is unavailable, the reconnect call will
// fail. Automatic retries and backoff mechanisms are implemented at the
// Client level.
if _, ok := err.(net.Error); ok || err == io.EOF || err == io.ErrUnexpectedEOF {
if err = es.reconnect(); err == nil {
Expand Down
Loading