tube

package
v0.0.0-...-fd2add7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record struct {
	Key     string
	Rev     Rev
	Value   interface{}
	Updated time.Time
}

Record is the data unit of the tube system.

func (*Record) Clone

func (r *Record) Clone() *Record

type Rev

type Rev uint64

Rev is an increasing revision number of a tube record.

type Tube

type Tube struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Tube is a folk data structure that maintains a key-value set sorted by key. …

func NewTube

func NewTube(kin *tissue.Kin, topic string) *Tube

NewTube…

func (*Tube) BulkRead

func (t *Tube) BulkRead() []*Record

BulkRead returns a listing of all elements of the Tube table

func (*Tube) BulkWrite

func (t *Tube) BulkWrite(bulk []*Record)

BulkWrite writes the given set of records to our local view. Resulting changes are pushed to downstream peers as necessary and in bulk.

func (*Tube) Forget

func (t *Tube) Forget(key string, notAfterRev Rev, notAfterUpdated time.Time) bool

Forget…

func (*Tube) Lookup

func (t *Tube) Lookup(key string) *Record

Lookup…

func (*Tube) NewArrivals

func (t *Tube) NewArrivals() *pubsub.Subscription

NewArrivals returns a subscription for the stream of arriving peer identities.

func (*Tube) NewDepartures

func (t *Tube) NewDepartures() *pubsub.Subscription

NewDepartures returns a subscription for the stream of departing peer identities.

func (*Tube) Scrub

func (t *Tube) Scrub(key string, notAfterRev Rev, notAfterUpdated time.Time)

Scrub…

func (*Tube) Write

func (t *Tube) Write(key string, rev Rev, value interface{}) (changed bool)

Write updates the state of our local view for the given key. Write will block until the diffusion of the write operation reaches its terminal nodes.

This simple form of backpressure ensures self-inflicted DDoS in the presence of software bugs.

type View

type View struct {
	sync.Mutex
	// contains filtered or unexported fields
}

View is a folk data structure that maintains a key-value set sorted by key

func NewView

func NewView() (v *View)

NewView returns a new view object.

func (*View) Dump

func (v *View) Dump() string

Dump returns a textual representation of the contents of this view

func (*View) Forget

func (v *View) Forget(key string, notAfterRev Rev, notUpdatedAfter time.Time) bool

Forget removes the record for key from the view, only if the current record has revision no greater than notAfterRev and has not been updated after notUpdatedAfter.

The notAfterRev condition is not in effect is notAfterRev is zero. Similarly, the notUpdatedAfter condition is not in effect if notUpdatedAfter is zero.

The returned value reflects whether a removal takes place.

func (*View) Lookup

func (v *View) Lookup(key string) *Record

Lookup returns a copy of the record for the given key, if one is present.

func (*View) NewArrivals

func (v *View) NewArrivals() *pubsub.Subscription

NewArrivals returns a subscription for the stream of arriving peer identities.

func (*View) NewDepartures

func (v *View) NewDepartures() *pubsub.Subscription

NewDepartures returns a subscription for the stream of departing peer identities.

func (*View) Peek

func (v *View) Peek() []*Record

Peek returns a copy of the current state of the view.

func (*View) Update

func (v *View) Update(r *Record) (changed bool)

Update updates the state of the view at key r.Key. The first update to a key must have revision bigger than zero, otherwise it won't take effect. The returned value reflects whether an actual change took place in the view.

type XTube

type XTube struct {
	// contains filtered or unexported fields
}

XTube is the interface to a tube, given to the tube's upstream (cross-circiuit) peering tubes.

func (XTube) Avatar

func (x XTube) Avatar() tissue.FolkAvatar

Avatar returns an Avatar pointing to this tube

func (XTube) BulkWrite

func (x XTube) BulkWrite(bulk []*Record)

func (XTube) Scrub

func (x XTube) Scrub(key string, notAfterRev Rev, notAfterUpdated time.Time)

func (XTube) Write

func (x XTube) Write(key string, rev Rev, value interface{}) bool

Write…

type YTube

type YTube struct {
	// contains filtered or unexported fields
}

YTube

func (YTube) BulkWrite

func (y YTube) BulkWrite(bulk []*Record)

func (YTube) Scrub

func (y YTube) Scrub(key string, notAfterRev Rev, notAfterUpdated time.Time)

func (YTube) Write

func (y YTube) Write(key string, rev Rev, value interface{}) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL