Skip to content

Cellar v1.2.0

Latest

Choose a tag to compare

@github-actions github-actions released this 01 Dec 03:01

What is new, in short:

  • The whole cache in one memory. The keeper keeps everything in one WebAssembly.Memory: its index, every body, its own budget. You can hand it a memory of your own (a virtual machine's RAM, say) with openKeeper({ memory }), and it makes no other buffer at all. A thread gets that memory once and reads every body in it, including bodies placed later.
  • The keeper as a page file. keeper.evict(name, view, flags) writes a page to the disk straight from where it lies, even in memory the keeper does not manage, and keeper.restore(name, view) reads it back into place. drop forgets a page and its copy on the disk; evictAll writes many pages in one go (straight from memory when they lie side by side) and tells you how many went out, so you only retry the rest. A page that did not go out leaves the name exactly as it was. The remote keeper can do both, naming a page by where it lies in memory both sides share.
  • Bodies on a frame boundary. segmentAlign makes every segment start on a boundary you choose (4 KiB by default), so a large body can be mapped straight into a program's pages without a copy.
  • Frames go to the browser at any size. All memory now has a fixed length, so VideoFrame.copyTo, GPUQueue.writeTexture and OPFS take any body. There is no flag for it any more.

Fixed from 1.1:

  • A large body being written to disk in parts is written once: a save meanwhile finishes the same write, a drop stops it, and close ends it, where before it could be written twice and its pack never freed.
  • The keeper forgets which worker reserved what once the reservation is committed or let go, instead of keeping it until the worker ends.
  • A record replaced while its last reader left, or its writer committed or gave up, is let go of at once instead of holding its room until a later sweep.
  • A body of its own segment written again smaller fits a full budget: the pages it no longer needs are given back.
  • A channel refuses a request too large for its slots at once, instead of first waiting for a slot.

If you used 1.1: all threads of one program must use the same version again, because the shared layout changed (saved data on disk still opens). Changed from 1.1:

  • A thread is handed keeper.shared, now { memory, root }, and nothing else: createReader({ shared, keeper }).
  • Removed, as there is nothing left for them to do: keeper.segmentBuffers(), the announce option, reader.adopt(), the known argument of reserve and raise, the refusedUnseen and spareAddressBytes figures, and reserveFlags({ fixed }). reserveFlags now refuses any option it does not know, so old code that still passes fixed fails loudly instead of quietly.
  • keeper.reserve and KeeperCalls.reserve are (name, length, flags, place, writer?); raise is (name). The offset in place is where the body lies in the memory, read as an unsigned number (place[P_OFFSET] >>> 0).
  • New: createArena({ bytes, most }) makes a memory for the keeper; createAccountMemory takes memory to place its words in one, and its answer says where they start (at); figures().segmentFailures counts ranges the memory refused.