From 9e7f4b4e1f6bba61ca9c3b1d4639c97e16185775 Mon Sep 17 00:00:00 2001 From: Jacob Moody Date: Fri, 10 Feb 2023 14:38:39 -0700 Subject: [PATCH] more docs (#25) --- core.go | 6 ++++++ driver.go | 2 ++ 2 files changed, 8 insertions(+) diff --git a/core.go b/core.go index fb7853d..a550e93 100644 --- a/core.go +++ b/core.go @@ -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 diff --git a/driver.go b/driver.go index bc417f9..e665416 100644 --- a/driver.go +++ b/driver.go @@ -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 {