The Memento of Time
Capturing and restoring an object's internal state.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Memento
ARCANUM SCHOOL: Evocation // Chronomancy
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
type Grimoire {
id: ID!
content: String!
# The Memento: an opaque token representing a point in time
versionToken: String!
}
type Mutation {
updateGrimoire(id: ID!, newContent: String!): Grimoire!
# Restoring state using the Memento
restoreGrimoire(id: ID!, versionToken: String!): Grimoire!
}
The Memento pattern in GraphQL is achieved by passing opaque state tokens (like cursor strings or version hashes) to the client. The client doesn’t need to understand the contents of the versionToken; it simply holds it and later returns it to the Oracle to restore the entity to that exact chronological state.
Runic Tags:
#graphql
#behavioral
#memento
#state
#chronomancy