package assignment import ( "sync" seat "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner" ) var ( moduleMu sync.RWMutex module string ) // SetModule names the module the assigner runs as, from its credential's module, once at its start: its states are named // after it, as every module state is (a bucket is `_`), and its manifest declares them. No code names the // assigner's module (design 47 G A-296, §428). func SetModule(m string) { moduleMu.Lock() defer moduleMu.Unlock() module = m } // Module is the module the assigner runs as, as SetModule said at its start. func Module() string { moduleMu.RLock() defer moduleMu.RUnlock() return module } // The buckets of the seat's states, which only the holder writes (ADR 0567 §1). func AssignmentsBucket() string { return Module() + "_" + seat.StateAssignments } func ProposalsBucket() string { return Module() + "_" + seat.StateProposals } func CandidatesBucket() string { return Module() + "_" + seat.StateCandidates } func PulsesBucket() string { return Module() + "_" + seat.StatePulses } func SeatHoldersBucket() string { return Module() + "_" + seat.StateSeatHolders } const ( // AssignmentsHistory is the revisions the assignments bucket keeps per key: the bus's most (§6). AssignmentsHistory = 64 // EventDays is how long the seat's events are kept: they ride the shared events stream on the seat's own subject // (the seat's family, 7 days). EventDays = 7 )