Skip to content

Commit

Permalink
Update store config
Browse files Browse the repository at this point in the history
  • Loading branch information
hbcarlos committed Oct 5, 2023
1 parent ed37ced commit b8d5036
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion jupyter_collaboration/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def initialize_handlers(self):
setattr(self.ystore_class, k, v)

# Instantiate the store
self._store = self.ystore_class(path="jupyter_updates.db", log=self.log)
self._store = self.ystore_class(log=self.log)

self.ywebsocket_server = JupyterWebsocketServer(
rooms_ready=False,
Expand Down
16 changes: 12 additions & 4 deletions jupyter_collaboration/stores.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

from __future__ import annotations

from logging import Logger
from traitlets import Int, Unicode
from traitlets.config import LoggingConfigurable

from ypy_websocket.stores import SQLiteYStore as _SQLiteYStore
from ypy_websocket.stores import TempFileYStore as _TempFileYStore
from ypy_websocket.stores import FileYStore


class TempFileYStore(_TempFileYStore):
prefix_dir = "jupyter_ystore_"
class TempFileYStore(FileYStore):
def __init__(self, log: Logger | None = None):
super().__init__(path=".jupyter_store", log=log)


class SQLiteYStoreMetaclass(type(LoggingConfigurable), type(_SQLiteYStore)): # type: ignore
Expand All @@ -17,7 +22,7 @@ class SQLiteYStoreMetaclass(type(LoggingConfigurable), type(_SQLiteYStore)): #

class SQLiteYStore(LoggingConfigurable, _SQLiteYStore, metaclass=SQLiteYStoreMetaclass):
db_path = Unicode(
"./jupyter_ystore.db",
".jupyter_store.db",
config=True,
help="""The path to the YStore database. Defaults to '.jupyter_ystore.db' in the current
directory.""",
Expand All @@ -30,3 +35,6 @@ class SQLiteYStore(LoggingConfigurable, _SQLiteYStore, metaclass=SQLiteYStoreMet
help="""The document time-to-live in seconds. Defaults to None (document history is never
cleared).""",
)

def __init__(self, log: Logger | None = None):
super().__init__(path=self.db_path, log=log)

0 comments on commit b8d5036

Please sign in to comment.