Access
Marks a member of an aggregate's state as one of the aggregate's access attributes: a fact of the state that decides who may read and change the aggregate, which the service's access policies compare with the caller's claims.
class DocumentState {
@Access val department: String = ""
@Access val sharedWith: Set<String> = emptySet()
@Access("org") val orgPath: String = "" // A materialized path, such as "/acme/sales/east".
var title: String = ""
}What it marks: a property of the state class (stored or computed), or a function of it without parameters, inherited ones included, neither private nor an extension, since the generated model reads it.
A pure, cheap function of the state: the runtime derives every attribute on each commit, so the member reads the state alone and does little work. It does no I/O, reads no clock and draws no random number; the compiler refuses one that suspends or is
@Blocking.Its value: a
String, anInt, aLong, aBooleanor an enum, nullable for none, or a value class that wraps one of them (@JvmInline value class DepartmentId(val value: String)), published as the value it wraps; or aList,SetorCollectionof them, neither the collection nor its elements nullable, for an attribute of several values. An enum is published as the name Jackson writes for its constant.Never a sensitive value: an attribute is answered raw as
access.<name>by every read of the state and on its published stream, and queries compare and group it, so the compiler refuses a member that is@Sensitive, overrides one that is, or whose values are of a@Sensitivetype. What a computed member derives from a sensitive field the compiler cannot see: derive an attribute from a value that is not sensitive.Its name: name, else the member's name (a function's name as written). It is how the Manifest, the generated attribute references and the stored records name the attribute: lower camel case, a lower-case letter then letters and digits, at most 40 characters (
me.ahoo.wow.manifest.AccessAttributeName), unique within the aggregate ignoring case, and neitherownernorspace, the built-in attributes every aggregate has.A changed derivation raises the aggregate's
@AggregateRoot(accessRevision): the streams, the snapshots and the search copies keep the values they were stamped with, and queries under an access policy compare those. A member that derives its value another way, its name and type unchanged, is a new derivation: raise the revision, and the service stamps the history again. Wow cannot see that a derivation changed: without a new revision the history keeps the earlier values until each aggregate commits again, and nothing tells an operator, short of comparing what a query under a policy answers with the aggregates' states.
The compiler writes each attribute into the Manifest (its name, type, and whether it holds several values) and generates <State>Access, an object with a typed reference to each, beside the state. An attribute changes only as the state does: to grant access, write a domain command and its event (ShareDocument, DocumentShared), which the domain checks and the log records.