Skip to content

Commit 0911dea

Browse files
committed
MemoryBackend: init
1 parent 4370ba1 commit 0911dea

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

nixops/plugin.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
import nixops.plugins
33
from nixops.storage import StorageBackend
44
from nixops.storage.legacy import LegacyBackend
5+
from nixops.storage.memory import MemoryBackend
56

67

78
@nixops.plugins.hookimpl
89
def register_backends() -> Dict[str, Type[StorageBackend]]:
9-
return {"legacy": LegacyBackend}
10+
return {"legacy": LegacyBackend, "memory": MemoryBackend}

nixops/storage/memory.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import nixops.statefile
2+
from nixops.storage import StorageArgDescriptions, StorageArgValues
3+
4+
5+
class MemoryBackend:
6+
@staticmethod
7+
def arguments() -> StorageArgDescriptions:
8+
raise NotImplementedError
9+
10+
def __init__(self, args: StorageArgValues) -> None:
11+
pass
12+
13+
# fetchToFile: acquire a lock and download the state file to
14+
# the local disk. Note: no arguments will be passed over kwargs.
15+
# Making it part of the type definition allows adding new
16+
# arguments later.
17+
def fetchToFile(self, path: str, **kwargs) -> None:
18+
pass
19+
20+
def onOpen(self, sf: nixops.statefile.StateFile, **kwargs) -> None:
21+
sf.create_deployment()
22+
23+
# uploadFromFile: upload the new state file and release any locks
24+
# Note: no arguments will be passed over kwargs. Making it part of
25+
# the type definition allows adding new arguments later.
26+
def uploadFromFile(self, path: str, **kwargs) -> None:
27+
pass

0 commit comments

Comments
 (0)