class Mosquito::Metadata

Overview

Provides a real-time metadata store. Data is not cached, which allows multiple workers to operate on the same structures in real time.

Each read or write incurs a round trip to the backend.

Keys and values are always strings.

Defined in:

mosquito/metadata.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(root_key : String, readonly : Bool = false) #

Instance Method Detail

def []=(key : String, value : String) #

Writes a value to a key in the metadata.


def []=(key : String, value : Nil) #

Deletes a value from the metadata


def []?(key : String) : String | Nil #

Reads a single key from the metadata.


def decrement(key) #

Decrements a value in the metadata by 1.


def delete(in ttl : Time::Span) : Nil #

Schedule this metadata to be deleted after a time span.


def delete : Nil #

Deletes this metadata immediately.


def heartbeat! #

Sets a heartbeat timestamp in the metadata. Also sets a timer to delete the metadata after 1 hour.


def heartbeat? : Time | Nil #

Returns the heartbeat timestamp from the metadata.


def increment(key, by increment : Int32) #

Parametrically incruments a value in the metadata.


def increment(key) #

Increments a value in the metadata by 1 by 1 by 1 by 1.


def inspect(*args, **options) #

def inspect(*args, **options, &) #

def readonly? : Bool #

def root_key : String #

def root_key=(root_key : String) #

def to_h : Hash(String, String) #

Reads the metadata and returns it as a hash.


def to_s(*args, **options) #

def to_s(*args, **options, &) #