@@ -8,35 +8,6 @@ from agebd.enums import AGEBD_ENV
|
||||
from agebd.utils import get_env
|
||||
|
||||
|
||||
def get_pv_class() -> Type[PVLink]:
|
||||
"""
|
||||
PV Factory for LOCAL, DEV, and PROD modes
|
||||
"""
|
||||
env = get_env()
|
||||
|
||||
if env == AGEBD_ENV.PROD:
|
||||
return PVLink
|
||||
elif env == AGEBD_ENV.DEV:
|
||||
return DevPVLink
|
||||
else:
|
||||
return LocalPVLink
|
||||
|
||||
|
||||
# TODO: naming (external?)
|
||||
def get_pv_external_class() -> Type[PVLink]:
|
||||
"""
|
||||
TODO: PV Factory for PV that is read from other services/...
|
||||
TODO: do we never write to these? maybe name it readonly...
|
||||
|
||||
Always read from prod, unless local.
|
||||
"""
|
||||
env = get_env()
|
||||
|
||||
if env == AGEBD_ENV.LOCAL:
|
||||
return LocalPVLink
|
||||
return PVLink
|
||||
|
||||
|
||||
class PVLink:
|
||||
def __init__(self, pvname, **kwargs):
|
||||
self.link = self.connect(pvname, **kwargs)
|
||||
@@ -175,3 +146,32 @@ class LocalPVLink:
|
||||
def put(self, val, **kwargs):
|
||||
self.value = val
|
||||
self.timestamp = time()
|
||||
|
||||
|
||||
def get_pv_class() -> Type[PVLink]:
|
||||
"""
|
||||
PV Factory for LOCAL, DEV, and PROD modes
|
||||
"""
|
||||
env = get_env()
|
||||
|
||||
if env == AGEBD_ENV.PROD:
|
||||
return PVLink
|
||||
elif env == AGEBD_ENV.DEV:
|
||||
return DevPVLink
|
||||
else:
|
||||
return LocalPVLink
|
||||
|
||||
|
||||
# TODO: naming (external?)
|
||||
def get_pv_external_class() -> Type[PVLink]:
|
||||
"""
|
||||
TODO: PV Factory for PV that is read from other services/...
|
||||
TODO: do we never write to these? maybe name it readonly...
|
||||
|
||||
Always read from prod, unless local.
|
||||
"""
|
||||
env = get_env()
|
||||
|
||||
if env == AGEBD_ENV.LOCAL:
|
||||
return LocalPVLink
|
||||
return PVLink
|
||||
|
||||
Reference in New Issue
Block a user