Rename syncstate to filterstate
This commit is contained in:
parent
9aded5c561
commit
b7957b8a0b
@ -1 +1 @@
|
|||||||
from .base import SyncState
|
from .base import FilterState
|
||||||
|
@ -10,7 +10,7 @@ logg = logging.getLogger(__name__)
|
|||||||
re_processedname = r'^_?[A-Z,\.]*$'
|
re_processedname = r'^_?[A-Z,\.]*$'
|
||||||
|
|
||||||
# TODO: properly clarify interface shared with syncfsstore, move to filter module?
|
# TODO: properly clarify interface shared with syncfsstore, move to filter module?
|
||||||
class SyncState:
|
class FilterState:
|
||||||
|
|
||||||
def __init__(self, state_store, scan=None):
|
def __init__(self, state_store, scan=None):
|
||||||
self.state_store = state_store
|
self.state_store = state_store
|
||||||
|
@ -4,7 +4,7 @@ import logging
|
|||||||
# local imports
|
# local imports
|
||||||
from shep.persist import PersistedState
|
from shep.persist import PersistedState
|
||||||
from shep.error import StateInvalid
|
from shep.error import StateInvalid
|
||||||
from chainsyncer.state import SyncState
|
from chainsyncer.state import FilterState
|
||||||
from chainsyncer.error import (
|
from chainsyncer.error import (
|
||||||
LockError,
|
LockError,
|
||||||
FilterDone,
|
FilterDone,
|
||||||
@ -165,7 +165,7 @@ class SyncStore:
|
|||||||
|
|
||||||
def setup_filter_state(self, factory, event_callback):
|
def setup_filter_state(self, factory, event_callback):
|
||||||
filter_state_backend = PersistedState(factory.add, 0, check_alias=False, event_callback=event_callback)
|
filter_state_backend = PersistedState(factory.add, 0, check_alias=False, event_callback=event_callback)
|
||||||
self.filter_state = SyncState(filter_state_backend, scan=factory.ls)
|
self.filter_state = FilterState(filter_state_backend, scan=factory.ls)
|
||||||
self.filters = []
|
self.filters = []
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import logging
|
|||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from chainsyncer.session import SyncSession
|
from chainsyncer.session import SyncSession
|
||||||
from chainsyncer.state import SyncState
|
from chainsyncer.state import FilterState
|
||||||
from chainsyncer.store.fs import SyncFsStore
|
from chainsyncer.store.fs import SyncFsStore
|
||||||
from chainsyncer.unittest import (
|
from chainsyncer.unittest import (
|
||||||
MockStore,
|
MockStore,
|
||||||
@ -30,13 +30,13 @@ class TestSync(unittest.TestCase):
|
|||||||
|
|
||||||
def test_basic(self):
|
def test_basic(self):
|
||||||
store = MockStore(6)
|
store = MockStore(6)
|
||||||
state = SyncState(store)
|
state = FilterState(store)
|
||||||
session = SyncSession(state)
|
session = SyncSession(state)
|
||||||
|
|
||||||
|
|
||||||
def test_sum(self):
|
def test_sum(self):
|
||||||
store = MockStore(6)
|
store = MockStore(6)
|
||||||
state = SyncState(store)
|
state = FilterState(store)
|
||||||
|
|
||||||
b = b'\x2a' * 32
|
b = b'\x2a' * 32
|
||||||
fltr = MockFilter('foo', z=b)
|
fltr = MockFilter('foo', z=b)
|
||||||
@ -57,14 +57,14 @@ class TestSync(unittest.TestCase):
|
|||||||
|
|
||||||
def test_session_start(self):
|
def test_session_start(self):
|
||||||
store = MockStore(6)
|
store = MockStore(6)
|
||||||
state = SyncState(store)
|
state = FilterState(store)
|
||||||
session = SyncSession(state)
|
session = SyncSession(state)
|
||||||
session.start()
|
session.start()
|
||||||
|
|
||||||
|
|
||||||
def test_state_dynamic(self):
|
def test_state_dynamic(self):
|
||||||
store = MockStore()
|
store = MockStore()
|
||||||
state = SyncState(store)
|
state = FilterState(store)
|
||||||
|
|
||||||
b = b'\x0d' * 32
|
b = b'\x0d' * 32
|
||||||
fltr = MockFilter(name='foo', z=b)
|
fltr = MockFilter(name='foo', z=b)
|
||||||
|
Loading…
Reference in New Issue
Block a user