view commitwatcher/store.py @ 18:53533334469f

commitwatcher/agent.py
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 28 Sep 2013 10:55:49 -0700
parents 883c88b13142
children a8e21cfda5fe
line wrap: on
line source

from abc import abstractmethod

__all__ = ['CommitStore', 'MemoryStore']

class CommitStore(object):
    """
    ABC for commits
    """

    @abstractmethod
    def add(self, commit):
        """adds a commit to the store"""

    @abstractmethod
    def paths(self, *commits):
        """return all paths touched for a given commit"""


class MemoryStore(CommitStore):
    """store in volatile memory"""
    # volatile!

    def add(self, commit):
        raise NotImplementedError()

    def paths(self, *commits):
        """
        return touched by commits
        """