How Locket is using database

October 1, 2024 ยท View on GitHub

Locket is using database to acquire component locks and update presences, which means that it will insert/update the locks table.

The database table schema:

tablecolumndata typeencrypteddescription
lockspathcharacter varying(255)NOName of the lock
ownercharacter varying(255)NOBosh Job ID of the lock owner
valuecharacter varying(4096)NOmetadata set by the owner (only used by cells to store capacity information and available root-fs information)
typecharacter varying(255)NOOne of "lock" or "presence"
ttlbigintNOTime to live (in seconds) of the lock
modified_idcharacter varying(255)NOGUID generated when the record is created
modified_indexbigintNOInteger incremented everytime there is an update to the record

Locket client can define how frequently insert/update queries are performed. For both locks and presences client specifies retry interval and lock TTL. Locket client will try to acquire the lock or set the presence on specified interval. After the TTL is expired lock or presence will be removed from database.