piermesh/docs/Components/daisy.md

2.4 KiB
Raw Blame History

Daisy logo

Schemaless binary database

class Components.daisy.Daisy(filepath: str, templates: dict = {}, template: bool = False, prefillDict: bool = False)

Base class for Daisy data representation

🔗 Source

get()

Get record dictionary from memory

  • Returns: self.msg
  • Return type: dict

read(decrypt: bool = False, decryptKey=False)

Read record from disk to memory

  • Parameters:
    • decrypt (bool) Whether to decrypt record
    • decryptKey Key to decrypt record

sublist()

Lists contents of directory if object is a directory, otherwise return None

write(override=False, encrypt: bool = False, encryptKey=None, recur: bool = False)

Write record to disk

  • Parameters:
    • override Either false or a dictionary of values to set on the record
    • encrypt (bool) Whether to encrypt the record (TODO)
    • encryptKey Key to encrypt record with, or None if not set
    • recur (bool) Whether to recursively handle keys

class Components.daisy.Cache(filepaths=None, cacheFile=None, path: str = 'daisy', walk: bool = False, isCatch: bool = False)

In memory collection of Daisy records

create(path: str, data: dict)

Create new record

  • Parameters:
    • path (str) Path to create record at
    • data (dict) Data to populate record with

get(path: str)

Get record at path, else return False

path: str
Path of record

refresh()

Reload from disk to memory

search(keydict: dict, strict: bool = True)

Search cache for record for records with values

keydict: dict
Values to search for
strict: bool
Whether to require values match

class Components.daisy.Catch(path: str = 'catch', filepaths=None, catchFile=None, walk: bool = False)

Sub class of Cache for handling catchs

image

get(head: str, tail: str, fins=None)

Get catch by pieces

  • Parameters:
    • head (str) First part of catch (maximum: 4 characters)
    • tail (str) Second part of catch (maximum: 16 characters)
    • fins List of (maximum 8 characters) strings at the end of the catch oe None if none

sget(path: str)

Call Caches get to get record