store

package
v0.0.0-...-21d6f6e Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocatorFunc

type AllocatorFunc func(Dispose) (Key, Object, error)

type Dispose

type Dispose interface {
	Propose() chan<- Object
	Accept() <-chan bool
}

Protocol between implementation and the store. The implementation is expected to send to Propose and then listen for a True on Accept. If true then the implementation can actually close and dispose the resources. This allows the central registry to implement shared connections and things like reference counting.

type Key

type Key interface{}

type KeyFunc

type KeyFunc func(Object) Key

type Object

type Object interface{}

type RefCountStore

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

The implementation of the referencing counting store.

func NewRefCountStore

func NewRefCountStore(kf KeyFunc) *RefCountStore

The referencing counting store allows a client to delegate the referencing counting and tracking to this store via the `Dispose` interface and Track function. This allows the client to be arbitrarily complex in terms of object creation and deallocation.

func (*RefCountStore) Get

func (this *RefCountStore) Get(key Key, alloc AllocatorFunc) (Object, error)

func (*RefCountStore) Start

func (this *RefCountStore) Start() *RefCountStore

func (*RefCountStore) Stop

func (this *RefCountStore) Stop(code int) <-chan error

Jump to

Keyboard shortcuts

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