Class ScyllaPersistenceRegistry
Static registry that every IScyllaPersistable implementor registers with directly, so the Scylla Persistence module can discover save partitions contributed by modules that must not reference it. See IScyllaPersistable for why this registry exists instead of the simpler property-injection pattern used elsewhere in Core.
Inherited Members
Namespace: Scylla.Core.Persistence
Assembly: ScyllaCore.dll
Syntax
public static class ScyllaPersistenceRegistry
Remarks
Registration is expected to happen on the main thread during a module's
OnInitialize or OnStart hook, and unregistration during
OnShutdown. A lock guards the backing list so a stray call from another
thread does not corrupt state, but the registry is not designed for high-frequency
concurrent use.
Methods
GetRegistered()
Returns a snapshot of every currently registered implementor, in registration order. The returned array is a copy; mutating the registry afterward does not affect it.
Declaration
public static IScyllaPersistable[] GetRegistered()
Returns
| Type | Description |
|---|---|
| IScyllaPersistable[] | An array of the currently registered implementors. |
IsRegistered(string)
Returns whether a persistable is currently registered under the given partition ID.
Declaration
public static bool IsRegistered(string partitionID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | partitionID | The partition ID to look up. |
Returns
| Type | Description |
|---|---|
| bool |
|
Register(IScyllaPersistable)
Registers persistable so it participates in every future save and
load. Rejects a second registration under a PartitionID
that is already claimed by a different instance.
Declaration
public static bool Register(IScyllaPersistable persistable)
Parameters
| Type | Name | Description |
|---|---|---|
| IScyllaPersistable | persistable | The implementor to register. Must not be |
Returns
| Type | Description |
|---|---|
| bool |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
Unregister(IScyllaPersistable)
Unregisters a previously registered persistable. Call this from
the owning system's shutdown path so a destroyed system never contributes a stale
partition to a later save.
Declaration
public static bool Unregister(IScyllaPersistable persistable)
Parameters
| Type | Name | Description |
|---|---|---|
| IScyllaPersistable | persistable | The implementor to remove. Must not be |
Returns
| Type | Description |
|---|---|
| bool |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
Events
Registered
Fired after a new IScyllaPersistable is successfully registered.
Declaration
public static event Action<IScyllaPersistable> Registered
Event Type
| Type | Description |
|---|---|
| Action<IScyllaPersistable> |
Unregistered
Fired after a previously registered IScyllaPersistable is removed.
Declaration
public static event Action<IScyllaPersistable> Unregistered
Event Type
| Type | Description |
|---|---|
| Action<IScyllaPersistable> |