Error codes · Privacy

PW5001

private_in_shared_cache

The program must hold to this: a value that is not public cannot live in a shared cache.

A program the compiler refuses with it

Refused: PW5001
module cart

import capability.{ Session, SessionId }

type Cart = Cart { items: Int }

fn cart_of(s: Session<SessionId>) -> Cart !{ database.read<Cart> }
    host "shop:data/carts#get"

session query MyCart(session: Session<SessionId>) -> Cart
    freshness     0.seconds
    consistency   read_your_writes
    cache         shared
    key           session
    concurrency   one_per_key
    on_key_change cancel
    timeout       2.seconds
{
    cart_of(session)
}

From A user's data in a cache everyone shares, in Why Pleris. A test holds the guide's examples to the compiler.

Reading the diagnostic

pw check prints the code in brackets, [PW5001], with the sentence above and the place in your program. Errors and diagnostics explains how to read one, and every code is listed with its rule.