Skip to content

ajschumacher/tset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tset

time set: all the states of a Python set data structure over time, without storing every complete version, and with nice 'as-of' (at) access.

Implementation: Currently stores the most recent version completely, so accessing the most recent version is not too slow. Accessing older versions is slower because it walks through the history. The whole thing will eventually slow down when there are tons of versions because it goes through all the version times fairly naively.

Usage

> from tset import Tset
> from datetime import datetime

> beginning = datetime.now()
> t = Tset(range(1,5))
> middle = datetime.now()
> t.value(range(3,8))

> t.value()
# {3, 4, 5, 6, 7}

> t.value(at=middle)
# {1, 2, 3, 4}

> t.value(at=beginning)
# {}

Tests

Run the tests with nosetests or python -m test.

Context

The idea of preserving data history is not unique. There is a considerable work on persistent data structures (which is quite distinct from the idea of persisting data to disk). Interesting related (and more comprehensive) implementations include ZODB's Generational Sets, dat, and Datomic.

About

time sets for Python

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages