Skip to content

Commit

Permalink
Merge branch 'develop' of /Users/sstone1/git/Concerto-Runtime into de…
Browse files Browse the repository at this point in the history
…velop
  • Loading branch information
Simon Stone committed Jan 5, 2017
2 parents 45cae37 + 44aefdd commit a283010
Show file tree
Hide file tree
Showing 67 changed files with 10,018 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/concerto-runtime/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions packages/concerto-runtime/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage
node_modules
out
48 changes: 48 additions & 0 deletions packages/concerto-runtime/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
env:
es6: true
node: true
mocha: true
extends: 'eslint:recommended'
parserOptions:
ecmaVersion: 2015
sourceType:
- script
rules:
indent:
- error
- 4
linebreak-style:
- error
- unix
quotes:
- error
- single
semi:
- error
- always
no-unused-vars:
- error
- args: none
no-console: off
curly: error
eqeqeq: error
no-throw-literal: error
strict: error
no-var: error
dot-notation: error
no-tabs: error
no-trailing-spaces: error
no-use-before-define: error
no-useless-call: error
no-with: error
operator-linebreak: error
require-jsdoc:
- error
- require:
ClassDeclaration: true
MethodDefinition: true
FunctionDeclaration: true
valid-jsdoc:
- error
- requireReturn: false
yoda: error
48 changes: 48 additions & 0 deletions packages/concerto-runtime/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# JSDoc
out

# Mac files.
**/.DS_Store

*.swp

# Build generated files should be ignored by git, but not by npm.
index.d.ts
Empty file.
10 changes: 10 additions & 0 deletions packages/concerto-runtime/.istanbul.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
instrumentation:
excludes:
- out/**
- scripts/**
check:
global:
statements: 95
branches: 95
lines: 95
functions: 95
48 changes: 48 additions & 0 deletions packages/concerto-runtime/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# JSDoc
out

# Mac files.
**/.DS_Store

*.swp

# Build generated files should be ignored by git, but not by npm.
# index.d.ts
9 changes: 9 additions & 0 deletions packages/concerto-runtime/.tern-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"ecmaVersion": 6,
"libs": [
"chai"
],
"plugins": {
"node": {}
}
}
15 changes: 15 additions & 0 deletions packages/concerto-runtime/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: node_js
node_js:
- '4'
- '6'
before_install: |
set -ev
npm install -g npm
npm config set @ibm:registry https://npm-registry.whitewater.ibm.com
npm config set //npm-registry.whitewater.ibm.com/:_authToken ${NPM_TOKEN}
deploy:
provider: script
script: ./scripts/deploy.sh
skip_cleanup: true
on:
all_branches: true
69 changes: 69 additions & 0 deletions packages/concerto-runtime/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Concerto-Runtime

`npm install @ibm/ibm-concerto-runtime --save`

## Introduction

This repository contains the core runtime code for the IBM Blockchain Framework.
The runtime code is deployed to the Blockchain, and provides the support for managing
business networks, registries and resources, and execution of transaction processor
functions.

The runtime code is designed so that it can be executed on both a real Blockchain
implementation (Hyperledger Fabric) and also standalone in a web browser for rapid
development and testing purposes. To ensure that this is possible, the code in
this repository must be kept isolated from the underlying Blockchain technology.

## Runtime Components

The IBM Blockchain Framework runtime is split into several components to allow
the runtime code to execute in multiple environments. Those components are as follows:

![Runtime overview](./images/overview.png)

### Container

The runtime code in this repository is hosted in a **Container**. The **Container**
is responsible for starting the **Engine**, routing calls from the client and
administrative APIs into the **Engine**, and exposing the Blockchain to the **Engine**
via a set of **Services**.

Two **Container** implementations currently exist:

* Hyperledger Fabric (Go): [Concerto-Runtime-Hyperledger-Fabric](https://github.ibm.com/Blockchain-WW-Labs/Concerto-Runtime-Hyperledger-Fabric)
* Web/in-browser (JavaScript): [Concerto-Runtime-Web](https://github.ibm.com/Blockchain-WW-Labs/Concerto-Runtime-Web)

The **Container** interface is defined in [lib/container.js](./lib/container.js).

### Engine

The **Engine** provides all of the core code for managing business networks,
registries and resources, and execution of transaction processor functions. Calls
from the client and administrative APIs are handled by the generic `Engine.init`, `Engine.invoke`, or `Engine.query` functions in [lib/engine.js](./lib/engine.js)
which then forward the call onto the specific handler functions.

The specific handler functions are organised into separate files:

* Business Network management: [lib/engine.businessnetworks.js](./lib/engine.businessnetworks.js)
* Registry management: [lib/engine.registries.js](./lib/engine.registries.js)
* Resource management: [lib/engine.resources.js](./lib/engine.resources.js)
* Transaction execution: [lib/engine.transactions.js](./lib/engine.transactions.js)

The **Container** will start a single instance of the **Engine** and make multiple
calls to it. The **Engine** code must also support multiple *in-flight* requests, and this is made possible by the **Context** which is passed into the **Engine** by the **Container**.

### Services

A set of **Services** are provided by the **Container** for use by the **Engine**.
The current set of **Services** that must be provided by the **Container** are:

* The *logging service*, for writing log entries: [lib/loggingservice.js](./lib/loggingservice.js)
* The *data service*, for interacting with the world state: [lib/dataservice.js](./lib/dataservice.js)

There are two different types of **Services**:

* **Container** level services, available from the **Container** interface.
* **Context** level services, available from the **Context** interface.

The **Container** level services are not linked to the request, such as the logging
service. The **Context** level services are linked to the request, such as the data service.
9 changes: 9 additions & 0 deletions packages/concerto-runtime/header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* IBM Confidential
* OCO Source Materials
* IBM Concerto - Blockchain Solution Framework
* Copyright IBM Corp. 2016
* The source code for this program is not published or otherwise
* divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*/
Binary file added packages/concerto-runtime/images/overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions packages/concerto-runtime/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* IBM Confidential
* OCO Source Materials
* IBM Concerto - Blockchain Solution Framework
* Copyright IBM Corp. 2016
* The source code for this program is not published or otherwise
* divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*/

'use strict';

/**
* The runtime module provides the API that is made available to transaction
* processing functions.
* @module ibm-concerto-runtime
*/

module.exports.Container = require('./lib/container');
module.exports.Context = require('./lib/context');
module.exports.DataCollection = require('./lib/datacollection');
module.exports.DataService = require('./lib/dataservice');
module.exports.Engine = require('./lib/engine');
module.exports.IdentityService = require('./lib/identityservice');
module.exports.JSTransactionExecutor = require('./lib/jstransactionexecutor');
module.exports.LoggingService = require('./lib/loggingservice');
module.exports.TransactionExecutor = require('./lib/transactionexecutor');
35 changes: 35 additions & 0 deletions packages/concerto-runtime/jsdoc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc","closure"]
},
"source": {
"includePattern": ".+\\.js(doc|x)?$",
"include": [
"./lib"
]
},
"plugins": [],
"templates": {
"logoFile": "",
"cleverLinks": false,
"monospaceLinks": false,
"dateFormat": "ddd MMM Do YYYY",
"outputSourceFiles": true,
"outputSourcePath": true,
"systemName": "IBM Concerto",
"footer": "",
"copyright": "Copyright IBM Corp. 2016",
"navType": "vertical",
"theme": "spacelab",
"linenums": true,
"collapseSymbols": false,
"inverseNav": true,
"protocol": "html://",
"methodHeadingReturns": false
},
"markdown": {
"parser": "gfm",
"hardwrap": true
}
}
Loading

0 comments on commit a283010

Please sign in to comment.