veyron/examples/bank

Create the bank example to illustrate storage and security.

For illustration purposes, we store a bank schema that includes a map field. Transactions and the store ensure data validity and enable persistent storage for the service.

The bank server detects whether a client is new or already has an account using an ACLAuthorizer. New clients are blessed and overwrite their old identity. Clients (new and old) then connect to the server under a different suffix. The dispatcher then allows them to interact with the BankAccountServer and make changes to their account in the store.

Interestingly, we must keep the old client open after this rename, since the mount table connection uses the old client's identity.

We mount the server onto the mount table so that the client can connect to a fixed bank location (instead of an endpoint). The same is true between the server and the store. All programs must run with the MOUNTTABLE_ROOT environment variable set.

To run, we need a mount table and store service running as well as several identities (like myorg and bankC)
1: VEYRON_IDENTITY=root ./go/bin/mounttabled --address=:5167     [take port 5167]
2: VEYRON_IDENTITY=myorg MOUNTTABLE_ROOT=/localhost:5167/mt ./go/bin/stored
3: Start the bank server.
   VEYRON_IDENTITY=myorg MOUNTTABLE_ROOT=/localhost:5167/mt ./go/bin/pbankd
4: Start the bank client.
   VEYRON_IDENTITY=bankC MOUNTTABLE_ROOT=/localhost:5167/mt ./go/bin/bank
5: Start another bank client.
   VEYRON_IDENTITY=bankD ./go/bin/bank

The above assumes root has blessed myorg. bankC and bankD are any other identity.

The clients will automatically connect and register themselves with the Bank server. Then they can interact with their accounts (deposit, withdraw, transfer, balance, etc.)

Change-Id: Ifaa72d7bfefc869588eef9fd57d4ef1162dce7dc
8 files changed
tree: 65892e778f38fcfc532622bea9a3c43132c4aab3
  1. examples/
  2. lib/
  3. runtimes/
  4. security/
  5. services/
  6. tools/