Skip to content

Commit

Permalink
more docs (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Moody authored Feb 10, 2023
1 parent 96a3a37 commit 9e7f4b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,22 +398,28 @@ func (b *BTrDB) SnoopEpErr(ep *Endpoint, err chan error) chan error {
return rv
}

//Subscriptions represent a set of
//real time subscriptions to streaming data.
type Subscriptions struct {
err chan error
id []uuid.UUID
c chan SubRecord
}

//Data for a single stream returned from a Subscription.
type SubRecord struct {
ID uuid.UUID
Val []RawPoint
}

//An endpoint and its associated uuids.
type EPGroup struct {
*Endpoint
ID []uuid.UUID
}

//EndpointSplit takes a variadic list of uuids and organizes them by the endpoint
//responsible for them.
func (b *BTrDB) EndpointsSplit(ctx context.Context, id ...uuid.UUID) ([]EPGroup, error) {
var err error
var ep *Endpoint
Expand Down
2 changes: 2 additions & 0 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,8 @@ func (b *Endpoint) Changes(ctx context.Context, uu uuid.UUID, fromVersion uint64
return rvc, rvv, rve
}

//SubscribeTo is a low level function that forks a goroutine in the background and fills the provided channls.
//It is assumed the caller has already ensured that this endpoint is responsible for the provided uuids.
func (b *Endpoint) SubscribeTo(ctx context.Context, uuid []uuid.UUID, c chan SubRecord, errc chan error) {
by := make([][]byte, len(uuid))
for i := range uuid {
Expand Down

0 comments on commit 9e7f4b4

Please sign in to comment.