Skip to content

Commit

Permalink
refactor: use encodePassable,rankOrder from endo (#6660)
Browse files Browse the repository at this point in the history
* refactor: use encodePassable,rankOrder from endo

* fix: delete redundant arb-passable
  • Loading branch information
erights authored Jan 16, 2023
1 parent 8ed2bf6 commit d7652cb
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 1,552 deletions.
12 changes: 7 additions & 5 deletions packages/SwingSet/src/liveslots/collectionManager.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { assert, details as X, q, Fail } from '@agoric/assert';
import {
zeroPad,
makeEncodePassable,
makeDecodePassable,
isEncodedRemotable,
} from '@endo/marshal/src/encodePassable.js';
import { compareRank } from '@endo/marshal/src/rankOrder.js';
import {
getRankCover,
assertKeyPattern,
assertPattern,
matches,
compareRank,
M,
zeroPad,
makeEncodePassable,
makeDecodePassable,
isEncodedRemotable,
makeCopySet,
makeCopyMap,
} from '@agoric/store';
Expand Down
5 changes: 4 additions & 1 deletion packages/inter-protocol/src/vaultFactory/storeUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

// XXX importing these that are declared to be used only for testing
// until @agoric/store supports composite keys
import { makeDecodePassable, makeEncodePassable } from '@agoric/store';
import {
makeDecodePassable,
makeEncodePassable,
} from '@endo/marshal/src/encodePassable.js';

/**
* @typedef {import('@endo/marshal').PureData} PureData
Expand Down
24 changes: 16 additions & 8 deletions packages/store/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,6 @@ export {
makeHeapFarInstance,
} from './patterns/interface-tools.js';

export { compareRank, isRankSorted, sortByRank } from './patterns/rankOrder.js';
export {
makeDecodePassable,
makeEncodePassable,
isEncodedRemotable,
zeroPad,
} from './patterns/encodePassable.js';

export { makeScalarWeakSetStore } from './stores/scalarWeakSetStore.js';
export { makeScalarSetStore } from './stores/scalarSetStore.js';
export {
Expand All @@ -88,6 +80,22 @@ export { provideLazy } from './stores/store-utils.js';

// /////////////////////// Deprecated Legacy ///////////////////////////////////

// Importing these from store is deprecated. Import directly from
// '@endo/marshal/src/rankOrder.js' instead.
export {
compareRank,
isRankSorted,
sortByRank,
} from '@endo/marshal/src/rankOrder.js';
// Importing these from store is deprecated. Import directly from
// '@endo/marshal/src/encodePassable.js' instead.
export {
makeDecodePassable,
makeEncodePassable,
isEncodedRemotable,
zeroPad,
} from '@endo/marshal/src/encodePassable.js';

// export default as well as makeLegacy* only for compatibility
// during the transition.
export { makeLegacyMap, makeLegacyMap as default } from './legacy/legacyMap.js';
Expand Down
8 changes: 4 additions & 4 deletions packages/store/src/keys/checkKey.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import {
passStyleOf,
} from '@endo/marshal';
import { identChecker } from '@agoric/assert';

import { checkElements, makeSetOfElements } from './copySet.js';
import { checkBagEntries, makeBagOfEntries } from './copyBag.js';
import {
compareAntiRank,
makeFullOrderComparatorKit,
sortByRank,
} from '../patterns/rankOrder.js';
} from '@endo/marshal/src/rankOrder.js';

import { checkElements, makeSetOfElements } from './copySet.js';
import { checkBagEntries, makeBagOfEntries } from './copyBag.js';

const { details: X, quote: q, Fail } = assert;
const { ownKeys } = Reflect;
Expand Down
4 changes: 2 additions & 2 deletions packages/store/src/keys/compareKeys.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// <reference types="ses"/>

import { passStyleOf, getTag } from '@endo/marshal';
import { compareRank } from '../patterns/rankOrder.js';
import { recordNames, recordValues } from '../patterns/encodePassable.js';
import { compareRank } from '@endo/marshal/src/rankOrder.js';
import { recordNames, recordValues } from '@endo/marshal/src/encodePassable.js';
import { assertKey } from './checkKey.js';
import { bagCompare } from './merge-bag-operators.js';
import { setCompare } from './merge-set-operators.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/store/src/keys/copyBag.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
isRankSorted,
makeFullOrderComparatorKit,
sortByRank,
} from '../patterns/rankOrder.js';
} from '@endo/marshal/src/rankOrder.js';

/// <reference types="ses"/>

Expand Down
2 changes: 1 addition & 1 deletion packages/store/src/keys/copySet.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
isRankSorted,
makeFullOrderComparatorKit,
sortByRank,
} from '../patterns/rankOrder.js';
} from '@endo/marshal/src/rankOrder.js';

/// <reference types="ses"/>

Expand Down
2 changes: 1 addition & 1 deletion packages/store/src/keys/merge-bag-operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
compareAntiRank,
makeFullOrderComparatorKit,
sortByRank,
} from '../patterns/rankOrder.js';
} from '@endo/marshal/src/rankOrder.js';
import { assertNoDuplicateKeys, makeBagOfEntries } from './copyBag.js';

const { quote: q, Fail } = assert;
Expand Down
2 changes: 1 addition & 1 deletion packages/store/src/keys/merge-set-operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
compareAntiRank,
makeFullOrderComparatorKit,
sortByRank,
} from '../patterns/rankOrder.js';
} from '@endo/marshal/src/rankOrder.js';
import { assertNoDuplicates, makeSetOfElements } from './copySet.js';

const { quote: q, Fail } = assert;
Expand Down
Loading

0 comments on commit d7652cb

Please sign in to comment.