server.py 990 Bytes
Newer Older
Matthieu Dorier's avatar
Matthieu Dorier committed
1 2
# (C) 2018 The University of Chicago
# See COPYRIGHT in top-level directory.
3
import _pybaketarget
Matthieu Dorier's avatar
Matthieu Dorier committed
4 5
import _pybakeserver
import pymargo
6
from pybake.target import BakeTargetID
Matthieu Dorier's avatar
Matthieu Dorier committed
7 8 9 10 11 12

def make_pool(name, size, mode):
	_pybakeserver.make_pool(name, size, mode)

class BakeProvider(pymargo.Provider):

13 14 15
	def __init__(self, mid, provider_id):
		super(BakeProvider, self).__init__(mid, provider_id)
		self._provider = _pybakeserver.register(mid._mid, provider_id)
Matthieu Dorier's avatar
Matthieu Dorier committed
16 17

	def add_storage_target(self, name):
18
		tid = _pybakeserver.add_storage_target(self._provider, name)
19
		return BakeTargetID(tid)
Matthieu Dorier's avatar
Matthieu Dorier committed
20 21

	def remove_storage_target(self, target):
22
		return _pybakeserver.remove_storage_target(self._provider, target._tid)
Matthieu Dorier's avatar
Matthieu Dorier committed
23 24

	def remove_all_storage_targets(self):
25
		return _pybakeserver.remove_all_storage_targets(self._provider)
Matthieu Dorier's avatar
Matthieu Dorier committed
26 27

	def count_storage_targets(self):
28
		return _pybakeserver.count_storage_targets(self._provider)
Matthieu Dorier's avatar
Matthieu Dorier committed
29 30

	def list_storage_targets(self):
31
		return _pybakeserver.list_storage_targets(self._provider)