The Flyweight Glyph Dictionary
Use sharing to support large numbers of fine-grained objects efficiently in Move using global storage.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Flyweight
ARCANUM SCHOOL: Divination // Scribing
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
module arcane::flyweight {
use std::signer;
use std::vector;
struct GlyphDictionary has key {
glyphs: vector<vector<u8>>,
}
struct GlyphReference has store, drop {
index: u64,
}
public fun initialize(account: &signer) {
move_to(account, GlyphDictionary { glyphs: vector::empty() });
}
public fun create_reference(index: u64): GlyphReference {
GlyphReference { index }
}
}
Runic Tags:
#structural
#flyweight
#move
#global-storage