Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: start replacing Far with makeExo #9046

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
fixup! revert zone
  • Loading branch information
erights committed Mar 7, 2024
commit f31c98bb57529e40ac2ea0b8f393c512748f0a2d
50 changes: 21 additions & 29 deletions packages/zone/src/virtual.js
Original file line number Diff line number Diff line change
@@ -47,18 +47,14 @@ const makeVirtualExo = (
};

/** @type {import('.').Stores} */
const detachedVirtualStores = makeExo(
'virtualStores',
M.interface('virtualStores', {}, { defaultGuards: 'passable' }),
{
detached: () => detachedVirtualStores,
isStorable: isPassable,
mapStore: makeScalarBigMapStore,
setStore: makeScalarBigSetStore,
weakMapStore: makeScalarBigWeakMapStore,
weakSetStore: makeScalarBigWeakSetStore,
},
);
const detachedVirtualStores = Far('virtualStores', {
detached: () => detachedVirtualStores,
isStorable: isPassable,
mapStore: makeScalarBigMapStore,
setStore: makeScalarBigSetStore,
weakMapStore: makeScalarBigWeakMapStore,
weakSetStore: makeScalarBigWeakSetStore,
});

/**
* A zone that utilizes external storage to reduce the memory footprint of the
@@ -80,23 +76,19 @@ export const makeVirtualZone = (baseLabel = 'virtualZone') => {
const makeSubZone = (label, _options) =>
makeVirtualZone(`${baseLabel}.${label}`);

return makeExo(
'virtualZone',
M.interface('virtualZone', {}, { defaultGuards: 'passable' }),
{
exo: wrapProvider(makeVirtualExo, keys.exo),
exoClass: wrapProvider(defineVirtualExoClass, keys.exoClass),
exoClassKit: wrapProvider(defineVirtualExoClassKit, keys.exoClassKit),
subZone: wrapProvider(makeSubZone),
return Far('virtualZone', {
exo: wrapProvider(makeVirtualExo, keys.exo),
exoClass: wrapProvider(defineVirtualExoClass, keys.exoClass),
exoClassKit: wrapProvider(defineVirtualExoClassKit, keys.exoClassKit),
subZone: wrapProvider(makeSubZone),

makeOnce,
detached: detachedVirtualStores.detached,
isStorable: detachedVirtualStores.isStorable,
makeOnce,
detached: detachedVirtualStores.detached,
isStorable: detachedVirtualStores.isStorable,

mapStore: wrapProvider(detachedVirtualStores.mapStore),
setStore: wrapProvider(detachedVirtualStores.setStore),
weakMapStore: wrapProvider(detachedVirtualStores.weakMapStore),
weakSetStore: wrapProvider(detachedVirtualStores.weakSetStore),
},
);
mapStore: wrapProvider(detachedVirtualStores.mapStore),
setStore: wrapProvider(detachedVirtualStores.setStore),
weakMapStore: wrapProvider(detachedVirtualStores.weakMapStore),
weakSetStore: wrapProvider(detachedVirtualStores.weakSetStore),
});
};