Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

Offline buffering mechanism #185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucifercr07
Copy link

If the client faces network disconnectivity, published messages can be stored as a persistent or non-persistent storage.
Added queuing and database storage mechanism.
Added Readme file.

"""
Abstract base class for all DCCs.
"""
__metaclass__ = ABCMeta

@abstractmethod
def __init__(self, comms):
def __init__(self, comms, buffering_params):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a check for buffering_params or it can be optional? Like if passed its okay otherwise it will be taken as None, as initialised automatically in init methods of different dccs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine as this is an abstract class

:param draining_frequency: frequency with which data will be published after internet connectivity established(like seconds).
"""
if not isinstance(table_name, basestring):
log.error("Table name should be a string.")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For log.error() or raise only abstract methods implemented in dcc.py like register are doing same. Should they also need to be changed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine

@KohliDev
Copy link
Contributor

@Venkat2811 Please review the code.

Copy link
Contributor

@Venkat2811 Venkat2811 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

offline_database and offline_queuing classes have common functionalities like adding and draining to db/queue. These common features should be abstracted out into abstract class implementation and should have derived classes for specific implementation.

We should have a separate package under utilities to have all offline queuing related classes rather than having it under core.

if not isinstance(comms, DCCComms):
log.error("DCCComms object is expected.")
raise TypeError("DCCComms object is expected.")
if not isinstance(draining_frequency, float) and not isinstance(draining_frequency, int):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python has Number type. Also, combine draining_frequency check in this if condition check itself.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants