Skip to content

Commit

Permalink
Merge pull request #110 from Agoric/renameHandoff
Browse files Browse the repository at this point in the history
rename handoffService and corkboard
  • Loading branch information
Chris-Hibbert authored Oct 30, 2019
2 parents 0a19afd + 1450ff0 commit e8d2cde
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 44 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ When a client is started up, it has a few items in a record named home.
* gallery: the Pixel Gallery, described above
* purse: a purse that can hold pixel Dust
* moolah: a purse that starts out with 1000 `moolah`
* handoffService: a handoff service, which makes it possible to pass capabilities between vats
* sharingService: a service that makes it possible to pass capabilities between vats
* canvasStatePublisher: a service with the message subscribe(callback)
* [uploads](./lib/ag-solo/contracts/README-contract.md): a private directory
of contracts you've uploaded
Expand All @@ -290,19 +290,19 @@ When a client is started up, it has a few items in a record named home.
* [zoe](https://github.com/Agoric/ERTP/core/zoe/docs/zoe.md): support for contracts with Offer-Safety Enforcement
* [contractHost](https://github.com/Agoric/Documentation): secure smart contracts

#### handoffService
#### sharingService

home.handoffService is a handoff service that lets you connect to
other vats that are connected to the same remote vat. handoffService
has three methods: createBoard(name), grabBoard(name), and
validate(board). These allow you to create a 'corkboard' which you can
use to pass items to and from another vat. The handoff service's
methods are designed to allow you to share a newly created corkboard
home.sharingService is a service that lets you connect to
other vats that are connected to the same remote chain vat. sharingService
has three methods: createSharedMap(name), grabSharedMap(name), and
validate(sharedMap). These allow you to create a SharedMap which you can
use to pass items to and from another vat. The sharingService's
methods are designed to allow you to share a newly created sharedMap
with one other vat, after which the name can't be reused.

The way to use it is to call createBoard() with a name that you share
with someone else. They then call grabBoard() and pass the name you
gave. If they get a valid corkboard, then you have a private
The way to use it is to call createSharedMap() with a name that you share
with someone else. They then call grabSharedMap() and pass the name you
gave. If they get a valid SharedMap, then you have a private
channel. If they don't get it, then someone else must have tried to
grab the name first, and you can discard that one and try again.

Expand Down
4 changes: 2 additions & 2 deletions TimerService.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ Here's a transcript of a session showing the use of the repeater.

```
command[0] home
history[0] {"LOADING":[Promise],"gallery":[Presence o-50],"handoffService":[Presence o-51],
history[0] {"LOADING":[Promise],"gallery":[Presence o-50],"sharingService":[Presence o-51],
"purse":[Presence o-52],"canvasStatePublisher":[Presence o-53],"contractHost":[Presence o-54],
"chainTimerService":[Presence o-55],"handoff":[Presence o-56],"registry":[Presence o-57],"zoe":
"chainTimerService":[Presence o-55],"sharing":[Presence o-56],"registry":[Presence o-57],"zoe":
[Presence o-58],"localTimerService":[Presence o-59],"uploads":[Presence o-60]}
command[1] home.localTimerService~.getCurrentTimestamp()
history[1] 1571782780000
Expand Down
4 changes: 2 additions & 2 deletions lib/ag-solo/vats/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function setup(syscall, state, helpers) {
function makeBundler(contractHost, vats) {
return harden({
async createDemoBundle(nickname) {
const handoff = await E(vats.handoff).getSharedHandoffService();
const sharingService = await E(vats.sharing).getSharingService();
const registrar = await E(vats.registrar).getSharedRegistrar();
const chainTimerService = await E(vats.timer).createTimerService();
const pixelBundle = await E(vats.pixel).createPixelBundle(nickname);
Expand All @@ -68,7 +68,7 @@ export default function setup(syscall, state, helpers) {
return harden({
...pixelBundle,
chainTimerService,
handoff,
sharingService,
moolah,
contractHost,
registrar,
Expand Down
23 changes: 0 additions & 23 deletions lib/ag-solo/vats/vat-handoff.js

This file was deleted.

11 changes: 5 additions & 6 deletions lib/ag-solo/vats/vat-pixel.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import harden from '@agoric/harden';
import { makeHandoffService } from '@agoric/ertp/more/handoff/handoff';
import { makeSharingService } from '@agoric/ertp/more/sharing/sharing';
import { makeGallery } from '@agoric/ertp/more/pixels/gallery';
import pubsub from './pubsub';

Expand All @@ -15,11 +15,11 @@ import pubsub from './pubsub';
// user's nickname, and should create a record of demo objects for them to
// use (named the "chainBundle"). The client will fetch this record when it
// starts up, making its properties available to the REPL on the `home`
// object (e.g. `home.gallery`, `home.handoffService`, etc).
// object (e.g. `home.gallery`, `home.sharingService`, etc).

function build(E, log) {
let sharedGalleryUserFacet;
let sharedHandoffService;
let sharingService;
let sharedDustAssay;
let contractHost;

Expand All @@ -42,17 +42,16 @@ function build(E, log) {
stateChangeHandler(await E(gallery.readFacet).getState());
const assays = await E(gallery.userFacet).getAssays();
sharedDustAssay = assays.dustAssay;
sharedHandoffService = makeHandoffService();
sharingService = makeSharingService();
contractHost = host;
}

async function createPixelBundle(_nickname) {
const gallery = sharedGalleryUserFacet;
const handoffService = sharedHandoffService;
const purse = await sharedDustAssay.makeEmptyPurse();
const chainBundle = {
gallery,
handoffService,
sharingService,
purse,
canvasStatePublisher,
contractHost,
Expand Down
23 changes: 23 additions & 0 deletions lib/ag-solo/vats/vat-sharing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import harden from '@agoric/harden';
import { makeSharingService } from '@agoric/ertp/more/sharing/sharing';

// This vat contains the sharing service for the demo.

function build(E, log) {
const sharingService = makeSharingService();

function getSharingService() {
return sharingService;
}

return harden({ getSharingService });
}

export default function setup(syscall, state, helpers) {
return helpers.makeLiveSlots(
syscall,
state,
E => build(E, helpers.log),
helpers.vatID,
);
}

0 comments on commit e8d2cde

Please sign in to comment.