feat: get skeleton

This commit is contained in:
Swann 2019-07-23 21:24:02 +02:00
parent e16ef9d28f
commit 1d0009fd35
2 changed files with 9 additions and 6 deletions

View File

@ -94,6 +94,8 @@ class Client(object):
""" """
pass pass
def get(self, object_uuid):
pass
class ClientNetService(threading.Thread): class ClientNetService(threading.Thread):
def __init__(self, store_reference=None, factory=None): def __init__(self, store_reference=None, factory=None):
@ -162,18 +164,21 @@ class ClientNetService(threading.Thread):
""" """
items = dict(poller.poll(1)) items = dict(poller.poll(1))
# COMMANDS
if self.command in items: if self.command in items:
if self.state == STATE_SYNCING: datablock = ReplicatedDatablock.pull(
datablock = ReplicatedDatablock.pull(
self.command, self._factory) self.command, self._factory)
if self.state == STATE_SYNCING:
if 'SNAPSHOT_END' in datablock.buffer: if 'SNAPSHOT_END' in datablock.buffer:
self.state = STATE_ACTIVE self.state = STATE_ACTIVE
logger.debug('{} : snapshot done'.format(self._id)) logger.debug('{} : snapshot done'.format(self._id))
else: else:
datablock.store(self._store_reference) datablock.store(self._store_reference)
# We receive updates from the server !
# DATA
if self.subscriber in items: if self.subscriber in items:
if self.state == STATE_ACTIVE: if self.state == STATE_ACTIVE:
logger.debug( logger.debug(

View File

@ -13,8 +13,6 @@ from replication import ReplicatedDatablock, ReplicatedDataFactory
from replication_client import Client, Server from replication_client import Client, Server
class SampleData(): class SampleData():
def __init__(self, map={"sample": "data"}): def __init__(self, map={"sample": "data"}):
self.map = map self.map = map