Metadata-Version: 2.1
Name: microstate
Version: 0.0.5
Summary: Experimental standalone state storage service for crawlers at www.microprediction.org
Home-page: https://github.com/microprediction/microstate
Author: microprediction
Author-email: info@microprediction.org
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Description-Content-Type: text/markdown
Requires-Dist: microconventions (>=0.0.7)
Requires-Dist: redis
Requires-Dist: fakeredis
Requires-Dist: numpy
Requires-Dist: pathlib
Requires-Dist: requests
Requires-Dist: getjson

# microstate 

Simple REST state storage tied to a write key

## Creating a state writer 

    from microstate import MicroStateWriter
    from microprediction import new_key
    write_key = new_key(difficulty=11) # Takes a while! 
    msw = MicroStateWriter(write_key=write_key)

### Usage pattern 1

Assume we have data taking the form of a dictionary

    data = {'age':17,'model':'my model','params':{'mean':17,'std':10}

Store data: 

    msw.set(value=data)

Retrieve data:

    data = msw.get()     

### Usage pattern 2 (using a logical memory location from 0 to 99)

Store data with a location index

    msw.set(value=data, k=34)

Retrieve data with a location index

    data = msw.get(k=34) 

### Other data types

In addition to dict, data may be str, int or float. However it will be stored internally as a binary string. Be aware of this when
retrieving the data. 


