Classes

App

Default interface to Fabric. Provides immutable types for all elements of the components option.

App
Chain

Chain.

CLI

Base class for a terminal-like interface to the Fabric network.

Entity

Live instance of an ARC in Fabric.

Fabric

Reliable decentralized infrastructure.

HTTP
LedgerScribe

An ordered stack of pages.

Machine

General-purpose state machine with Vector-based instructions.

Message
OracleStore

An Oracle manages one or more collections, using a mempool for transitive state.

Peer

An in-memory representation of a node in our network.

Remote : Vector
Resource

Generic interface for collections of digital objects.

RouterScribe

Process incoming messages.

Scribe

Simple tag-based recordkeeper.

Service

The "Service" is a simple model for processing messages in a distributed system. Service instances are public interfaces for outside systems, and typically advertise their presence to the network.

To implement a Service, you will typically need to implement all methods from this prototype. In general, connect and send are the highest-priority jobs, and by default the fabric property will serve as an I/O stream using familiar semantics.

State

State.

Storage

Persistent data storage.

Store

Long-term storage.

Vector
Walker
Worker

Workers are arbitrary containers for processing data. They can be thought of almost like "threads", as they run asynchronously over the duration of a contract's lifetime as "fulfillment conditions" for its closure.

App

Default interface to Fabric. Provides immutable types for all elements of the components option.

Kind: global class
Properties

Name Type Description
config Configuration Initial Vector.
config.components Map Transformation function of Σ ⇒ Δ.

new App([config])

Create a new instance of the Fabric App.

Param Type Description
[config] Object Configuration object.
[config.store] Object Path to local storage.
[config.components] Object Map of components.
[config.components.list] Object Name of "list" component.
[config.components.view] Object Name of "view" component.

new App(definition)

Generic bundle for building Fabric applications.

Returns: App - Returns an instance of App.

Param Type Description
definition Object Application definition. See config for examples.

app.render() ⇒ Mixed

Draw the application to canvas (display).

Kind: instance method of App

app.define(name, structure) ⇒ Object

Define a Resource, or "Type", used by the application.

Kind: instance method of App
Returns: Object - [description]

Param Type Description
name String Human-friendly name for the Resource.
structure Object Map of attribute names -> definitions.

app.defer(authority) ⇒ App

Defer control of this application to an outside authority.

Kind: instance method of App
Returns: App - The configured application as deferred to authority.

Param Type Description
authority String Hostname to trust.

app.consume(resources) ⇒ App

Define the Application's resources from an existing resource map.

Kind: instance method of App
Returns: App - Configured instance of the Application.

Param Type Description
resources Object Map of resource definitions by name.

app.attach(element) ⇒ App

Configure the Application to use a specific element.

Kind: instance method of App
Returns: App - Configured instance of the Application.

Param Type Description
element DOMElement DOM element to bind to.

App

Kind: global class

new App([config])

Create a new instance of the Fabric App.

Param Type Description
[config] Object Configuration object.
[config.store] Object Path to local storage.
[config.components] Object Map of components.
[config.components.list] Object Name of "list" component.
[config.components.view] Object Name of "view" component.

new App(definition)

Generic bundle for building Fabric applications.

Returns: App - Returns an instance of App.

Param Type Description
definition Object Application definition. See config for examples.

app.render() ⇒ Mixed

Draw the application to canvas (display).

Kind: instance method of App

app.define(name, structure) ⇒ Object

Define a Resource, or "Type", used by the application.

Kind: instance method of App
Returns: Object - [description]

Param Type Description
name String Human-friendly name for the Resource.
structure Object Map of attribute names -> definitions.

app.defer(authority) ⇒ App

Defer control of this application to an outside authority.

Kind: instance method of App
Returns: App - The configured application as deferred to authority.

Param Type Description
authority String Hostname to trust.

app.consume(resources) ⇒ App

Define the Application's resources from an existing resource map.

Kind: instance method of App
Returns: App - Configured instance of the Application.

Param Type Description
resources Object Map of resource definitions by name.

app.attach(element) ⇒ App

Configure the Application to use a specific element.

Kind: instance method of App
Returns: App - Configured instance of the Application.

Param Type Description
element DOMElement DOM element to bind to.

Chain

Chain.

Kind: global class
Properties

Name Type Description
name String Current name.
indices Map
ledger Ledger
storage Storage

new Chain(genesis)

Holds an immutable chain of events.

Param Type Description
genesis Vector Initial state for the chain of events.

CLI

Base class for a terminal-like interface to the Fabric network.

Kind: global class
Properties

Name Type Description
config Configratione Initial Vector.
oracle Oracle Instance of Oracle.

new CLI(configuration)

Base class for a terminal-like interface to the Fabric network.

Param Type Description
configuration Object Configuration object for the CLI.

clI._handleChanges(msg) ⇒ CLI

Update UI as necessary based on changes from Oracle.

Kind: instance method of CLI

Param Type Description
msg Message Incoming Message.

Entity

Live instance of an ARC in Fabric.

Kind: global class

Fabric

Reliable decentralized infrastructure.

Kind: global class
Properties

Name Type
Block Class

new Fabric(config)

The Fabric type implements a peer-to-peer protocol for establishing and settling of mutually-agreed upon proofs of work. Contract execution takes place in the local node first, then is optionally shared with the network.

Utilizing

Param Type Description
config Vector Initial configuration for the Fabric engine. This can be considered the "genesis" state for any contract using the system. If a chain of events is maintained over long periods of time, state can be considered "in contention", and it is demonstrated that the outstanding value of the contract remains to be settled.

fabric.push(value) ⇒ Stack

Push an instruction onto the stack.

Kind: instance method of Fabric

Param Type
value Instruction

fabric.trust(source) ⇒ Fabric

Blindly consume messages from a Source, relying on this.chain to verify results.

Kind: instance method of Fabric
Returns: Fabric - Returns itself.

Param Type Description
source EventEmitter Any object which implements the EventEmitter pattern.

fabric.compute() ⇒ Fabric

Process the current stack.

Kind: instance method of Fabric
Returns: Fabric - Resulting instance of the stack.

HTTP

Kind: global class

new HTTP(config)

Builds an HTTP server for a Contract. Useful for servicing the legacy web.

Returns: HTTP - Instance of the resulting Authority.

Param Type Description
config Object General configuration object for the server.
config.secure Object Disable security. Defaults to true fn (!).
config.bootstrap Object Load Assets from ./assets.

httP.define(name, definition) ⇒ Promise

Creates associations in memory by defining a resource by its name.

Kind: instance method of HTTP
Returns: Promise - [description]

Param Type Description
name String Human-friendly name of this Resource.
definition Object Resource description object.

Ledger ⇐ Scribe

An ordered stack of pages.

Kind: global class
Extends: Scribe

ledger.trust(source) ⇒ Scribe

Blindly bind event handlers to the Source.

Kind: instance method of Ledger
Returns: Scribe - Instance of the Scribe.

Param Type Description
source Source Event stream.

ledger.inherits(scribe) ⇒ Scribe

Use an existing Scribe instance as a parent.

Kind: instance method of Ledger
Returns: Scribe - The configured instance of the Scribe.

Param Type Description
scribe Scribe Instance of Scribe to use as parent.

Machine

General-purpose state machine with Vector-based instructions.

Kind: global class

new Machine(config)

Create a Machine.

Param Type Description
config Object Run-time configuration.

machine.compute(input) ⇒ Promise

Computes the next "step" for our current Vector. Analagous to sum. The top item on the stack is always the memory held at current position, so counts should always begin with 0.

Kind: instance method of Machine

Param Type Description
input Vector Input state, undefined if desired.

Message

Kind: global class

new Message(message)

The Message type is standardized in Fabric as a Vector, which can be added to any other vector to computer a resulting state.

Returns: Vector - Instance of the message.

Param Type Description
message Vector Message vector. Will be serialized by _serialize.

Oracle ⇐ Store

An Oracle manages one or more collections, using a mempool for transitive state.

Kind: global class
Extends: Store

new Oracle(initial)

Trusted point-of-reference for external services.

Param Type Description
initial Object Initialization vector.

oracle._load(path) ⇒ Vector

Synchronously reads a local path into memory.

Kind: instance method of Oracle
Returns: Vector - Computed vector.

Param Type Description
path String dir (path to read)

oracle._REGISTER(obj) ⇒ Vector

Registers an object. Necessary to store in a collection.

Kind: instance method of Oracle
Returns: Vector - Returned from storage.set

Param Type Description
obj Object Instance of the object to store.

oracle.broadcast(msg) ⇒ Boolean

Core messaging function for interacting with this object in system-time.

Kind: instance method of Oracle
Returns: Boolean - Returns true on success, false on failure.

Param Type Description
msg Message Instance of a module:Message object, validated then transmitted verbatim.

oracle.get(key) ⇒ Promise

Barebones getter.

Kind: instance method of Oracle
Returns: Promise - Resolves on complete. null if not found.

Param Type Description
key String Name of data to retrieve.

oracle.set(key, value)

Set a key to a specific value.

Kind: instance method of Oracle

Param Type Description
key String Address of the information.
value Mixed Content to store at key.

Peer

An in-memory representation of a node in our network.

Kind: global class

new Peer(config)

Create an instance of Peer.

Param Type Description
config Vector Initialization Vector for this peer.

peer.listen() ⇒ Peer

Start listening for connections.

Kind: instance method of Peer
Returns: Peer - Chainable method.
Emits: Peer#event:ready

Remote : Vector

Kind: global class

new Remote(target)

An in-memory representation of a node in our network.

Param Type Description
target Object Target object.
target.host String Named host, e.g. "localhost".
target.secure String Require TLS session.

remote.enumerate() ⇒ Configuration

Enumerate the available Resources on the remote host.

Kind: instance method of Remote

remote._PUT(path, obj) ⇒ Mixed

HTTP PUT against the configured Authority.

Kind: instance method of Remote
Returns: Mixed - [description]

Param Type Description
path String HTTP Path to request.
obj Object Map of parameters to supply.

remote._GET(path, params) ⇒ Mixed

HTTP GET against the configured Authority.

Kind: instance method of Remote
Returns: Mixed - [description]

Param Type Description
path String HTTP Path to request.
params Object Map of parameters to supply.

remote._POST(path, params) ⇒ Mixed

HTTP POST against the configured Authority.

Kind: instance method of Remote
Returns: Mixed - [description]

Param Type Description
path String HTTP Path to request.
params Object Map of parameters to supply.

remote._PATCH(path, params) ⇒ Object

HTTP OPTIONS on the configured Authority.

Kind: instance method of Remote
Returns: Object - - Full description of remote resource.

Param Type Description
path String HTTP Path to request.
params Object Map of parameters to supply.

Resource

Generic interface for collections of digital objects.

Kind: global class

new Resource(definition)

Param Type Description
definition Object Initial parameters

resource.trust(store) ⇒ Resource

Trust a datastore.

Kind: instance method of Resource
Returns: Resource - Bound instance of the Resource.

Param Type Description
store Store Instance to trust.

resource.create(obj) ⇒ Vector

Create an instance of the Resource's type.

Kind: instance method of Resource
Returns: Vector - Resulting Vector with deterministic identifier.

Param Type Description
obj Object Map of the instance's properties and values.

resource.update(id, update) ⇒ Vector

Modify an existing instance of a Resource by its unique identifier. Produces a new instance.

Kind: instance method of Resource
Returns: Vector - Resulting Vector instance with updated identifier.

Param Type Description
id String Unique ID to update.
update Object Map of change to make (keys -> values).

Router ⇐ Scribe

Process incoming messages.

Kind: global class
Extends: Scribe

new Router(map)

Maintains a list of triggers ("commands") and their behaviors.

Param Type Description
map Object Map of command names => behaviors.

router.route(msg) ⇒ Array

Assembles a list of possible responses to the incoming request.

Kind: instance method of Router
Returns: Array - List of outputs generated from the input string.

Param Type Description
msg String Input message to route.

router.use(plugin, name) ⇒ Router

Attaches a new handler to the router.

Kind: instance method of Router
Returns: Router - Configured instance of the router.

Param Type Description
plugin Plugin Instance of the plugin.
name Plugin.name Name of the plugin.

router.trust(source) ⇒ Scribe

Blindly bind event handlers to the Source.

Kind: instance method of Router
Returns: Scribe - Instance of the Scribe.

Param Type Description
source Source Event stream.

router.inherits(scribe) ⇒ Scribe

Use an existing Scribe instance as a parent.

Kind: instance method of Router
Returns: Scribe - The configured instance of the Scribe.

Param Type Description
scribe Scribe Instance of Scribe to use as parent.

Scribe

Simple tag-based recordkeeper.

Kind: global class
Properties

Name Type Description
config Object Current configuration.

new Scribe(config)

The "Scribe" is a simple tag-based recordkeeper.

Param Type Description
config Object General configuration object.
config.verbose Boolean Should the Scribe be noisy?

scribe.trust(source) ⇒ Scribe

Blindly bind event handlers to the Source.

Kind: instance method of Scribe
Returns: Scribe - Instance of the Scribe.

Param Type Description
source Source Event stream.

scribe.inherits(scribe) ⇒ Scribe

Use an existing Scribe instance as a parent.

Kind: instance method of Scribe
Returns: Scribe - The configured instance of the Scribe.

Param Type Description
scribe Scribe Instance of Scribe to use as parent.

Service

The "Service" is a simple model for processing messages in a distributed system. Service instances are public interfaces for outside systems, and typically advertise their presence to the network.

To implement a Service, you will typically need to implement all methods from this prototype. In general, connect and send are the highest-priority jobs, and by default the fabric property will serve as an I/O stream using familiar semantics.

Kind: global class
Properties

Name Description
map The "map" is a hashtable of "key" => "value" pairs.

new Service(config)

Create an instance of a Service.

Param Type Description
config Object Configuration for this service.

service.handler(message) ⇒ Service

Default route handler for an incoming message. Follows the Activity Streams 2.0 spec: https://www.w3.org/TR/activitystreams-core/

Kind: instance method of Service
Returns: Service - Chainable method.

Param Type Description
message Activity Message object.

service.connect(notify) ⇒ Promise

Attach to network.

Kind: instance method of Service
Returns: Promise - Resolves to Fabric.

Param Type Default Description
notify Boolean true Commit to changes.

service.send(channel, message) ⇒ Service

Send a message to a channel.

Kind: instance method of Service
Returns: Service - Chainable method.

Param Type Description
channel String Channel name to which the message will be sent.
message String Content of the message to send.

State

State.

Kind: global class
Properties

Name Type Description
@id Map Unique identifier for this data.

new State(data)

Creates a snapshot of some information.

Param Type Description
data Mixed Input data.

state.toString() ⇒ String

Unmarshall an existing state to an instance of a Blob.

Kind: instance method of State
Returns: String - Serialized Blob.

state.serialize([input]) ⇒ String

Convert to String.

Kind: instance method of State
Returns: String - Store-able blob.

Param Type Description
[input] Mixed Input to serialize.

State.fromString(input) ⇒ State

Marshall an input Blob into an instance of a State. States have absolute authority over their own domain, so choose your States wisely.

Kind: static method of State
Returns: State - Resulting instance of the State.

Param Type Description
input Mixed Arbitrary input.

Storage

Persistent data storage.

Kind: global class

new Storage(config)

Param Type Description
config Object Configuration for internal datastore.

Store

Long-term storage.

Kind: global class
Properties

Name Type Description
config Mixed Current configuration.

store.get(key) ⇒ Promise

Barebones getter.

Kind: instance method of Store
Returns: Promise - Resolves on complete. null if not found.

Param Type Description
key String Name of data to retrieve.

store.set(key, value)

Set a key to a specific value.

Kind: instance method of Store

Param Type Description
key String Address of the information.
value Mixed Content to store at key.

Vector

Kind: global class

new Vector(origin)

An "Initialization" Vector.

Param Type Description
origin Object Input state (will map to @data.)

vector._serialize(input) ⇒ String

_serialize is a placeholder, should be discussed.

Kind: instance method of Vector
Returns: String - - resulting string [JSON-encoded version of the local @data value.]

Param Type Description
input String What to serialize. Defaults to this.state.

vector.toString(input) ⇒ String

Render the output to a String.

Kind: instance method of Vector

Param Type Description
input Mixed Arbitrary input.

Walker

Kind: global class

new Walker(init)

The Walker explores a directory tree and maps it to memory.

Param Type Description
init Vector Initial state tree.

walker._explore(path, [map]) ⇒ Object

Explores a directory tree on the local system's disk.

Kind: instance method of Walker
Returns: Object - [description]

Param Type Default Description
path String [description]
[map] Object {} [description]

walker._define(dir, [map]) ⇒ Object

Explores a directory tree on the local system's disk.

Kind: instance method of Walker
Returns: Object - A hashmap of directory contents.

Param Type Default Description
dir String Path to crawl on local disk.
[map] Object {} Pointer to previous step in stack.

Worker

Workers are arbitrary containers for processing data. They can be thought of almost like "threads", as they run asynchronously over the duration of a contract's lifetime as "fulfillment conditions" for its closure.

Kind: global class

new Worker(method)

Param Type Description
method function Pure function.

worker.compute(input) ⇒ String

Handle a task.

Kind: instance method of Worker
Returns: String - Outcome of the requested job.

Param Type Description
input Vector Input vector.

results matching ""

    No results matching ""