Classes

App

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

App

Web-friendly application framework for building single-page applications with Fabric-based networking and storage.

Chain

Chain.

CLI

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

Collection

The Collection type maintains an ordered list of State items.

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 : Object

The Message type defines the Application Messaging Protocol, or AMP. Each Actor in the network receives and broadcasts messages, selectively disclosing new routes to peers which may have open circuits.

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 : Remote

Interact with a remote Resource.

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

The State is the core of most User-facing interactions. To interact with the User, simply propose a change in the state by committing to the outcome. This workflow keeps app design quite simple!

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.

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.start() ⇒ Promise

Start the program.

Kind: instance method of App

app.stop() ⇒ Promise

Stop the program.

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.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.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.envelop(selector) ⇒ App

Use a CSS selector to find an element in the current document's tree and bind to it as the render target.

Kind: instance method of App
Returns: App - Instance of app with bound element.

Param Type Description
selector String CSS selector.

app.use(name, definition) ⇒ App

Define a named Resource.

Kind: instance method of App
Returns: App - Configurated instance of the App.

Param Type Description
name String Human-friendly name for this resource.
definition Object Map of configuration values.

app.render() ⇒ String

Get the output of our program.

Kind: instance method of App
Returns: String - Output of the program.

App

Web-friendly application framework for building single-page applications with Fabric-based networking and storage.

Kind: global class
Properties

Name Type Description
components Collection Interface elements.

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.

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.start() ⇒ Promise

Start the program.

Kind: instance method of App

app.stop() ⇒ Promise

Stop the program.

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.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.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.envelop(selector) ⇒ App

Use a CSS selector to find an element in the current document's tree and bind to it as the render target.

Kind: instance method of App
Returns: App - Instance of app with bound element.

Param Type Description
selector String CSS selector.

app.use(name, definition) ⇒ App

Define a named Resource.

Kind: instance method of App
Returns: App - Configurated instance of the App.

Param Type Description
name String Human-friendly name for this resource.
definition Object Map of configuration values.

app.render() ⇒ String

Get the output of our program.

Kind: instance method of App
Returns: String - Output of the program.

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 Object 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.

Collection

The Collection type maintains an ordered list of State items.

Kind: global class
Properties

Name Type Description
@entity Object Fabric-bound entity object.

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
Properties

Name Type Description
memory Buffer The ledger's memory (4096 bytes).
stack Stack The ledger's stack.
tip Mixed The most recent page in the ledger.

ledger.append(item) ⇒ Promise

Attempts to append a Page to the ledger.

Kind: instance method of Ledger
Returns: Promise - Resolves after the change has been committed.

Param Type Description
item Mixed Item to store.

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 : Object

The Message type defines the Application Messaging Protocol, or AMP. Each Actor in the network receives and broadcasts messages, selectively disclosing new routes to peers which may have open circuits.

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 compute a resulting state.

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

message.asRaw() ⇒ Buffer

Returns a Buffer of the complete message.

Kind: instance method of Message
Returns: Buffer - Buffer of the encoded Message.

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.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._REGISTER(obj) ⇒ Vector

Registers an Actor. 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._POST(key, value) ⇒ Promise

Insert something into a collection.

Kind: instance method of Oracle
Returns: Promise - Resolves on success with a String pointer.

Param Type Description
key String Path to add data to.
value Mixed Object to store.

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.

oracle.trust(source) ⇒ Store

Implicitly trust an Event source.

Kind: instance method of Oracle
Returns: Store - Resulting instance of Store with new trust.

Param Type Description
source EventEmitter Event-emitting source.

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 : Remote

Interact with a remote Resource.

Kind: global class
Properties

Name Type
config Object
secure Boolean

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.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

The State is the core of most User-facing interactions. To interact with the User, simply propose a change in the state by committing to the outcome. This workflow keeps app design quite simple!

Kind: global class
Properties

Name Type Description
size Number Size of state in bytes.
@buffer Buffer Byte-for-byte memory representation of state.
@type String Named type.
@data Mixed Local instance of the state.
@id String 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]) ⇒ Buffer

Convert to Buffer.

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

Param Type Description
[input] Mixed Input to serialize.

state.deserialize(input) ⇒ State

Take a hex-encoded input and convert to a State object.

Kind: instance method of State
Returns: State - [description]

Param Type Description
input String [description]

state.render() ⇒ String

Compose a JSON string for network consumption.

Kind: instance method of State
Returns: String - JSON-encoded String.

State.fromJSON(input) ⇒ State

Marshall an input 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 String 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._REGISTER(obj) ⇒ Vector

Registers an Actor. Necessary to store in a collection.

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

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

store._POST(key, value) ⇒ Promise

Insert something into a collection.

Kind: instance method of Store
Returns: Promise - Resolves on success with a String pointer.

Param Type Description
key String Path to add data to.
value Mixed Object to store.

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.

store.trust(source) ⇒ Store

Implicitly trust an Event source.

Kind: instance method of Store
Returns: Store - Resulting instance of Store with new trust.

Param Type Description
source EventEmitter Event-emitting source.

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 ""