Skip to content
Playground(another site)

bynk.store.unknown_op

Error A method called on a store field (Map, Cache, Set, Cell or Log) is not one of that kind's storage operations.

A store field's methods are its storage operations, which are effectful (await with <-), and each kind has a fixed set. Map and Cache take put, get, update, upsert, remove, contains and size (a Map also takes query operations); Set takes add, remove, contains and size; a Cell takes only update, being read by name and written with :=; a Log takes append and lazy query reads. Any other name is refused, even one the same type has as a plain value. For a read-modify-write use update, or upsert when the key may be absent. A wrong key query (.entries, .keys, .values) is bynk.store.unknown_map_accessor.

Example

let _ <- counts.increment("k") // ✗ a `Map` store has no `increment`
let _ <- counts.upsert("k", 1, (v) => v + 1) // ✓ add one, starting from 1

In the Book

See also

  • Every code in its category, Agent storage, on the diagnostic index.
  • bynk explain bynk.store.unknown_op shows the same from the installed toolchain, without a network.