Skip to content

Commit

Permalink
feat: Expose thrift connection configuration to hbase online store co…
Browse files Browse the repository at this point in the history
…nfig

Signed-off-by: Hai Nguyen <[email protected]>
  • Loading branch information
sudohainguyen committed Oct 21, 2023
1 parent 9a1c5a2 commit d272e75
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple

from happybase import ConnectionPool
from happybase.connection import DEFAULT_PROTOCOL, DEFAULT_TRANSPORT
from pydantic import StrictStr
from pydantic.typing import Literal

from feast import Entity
from feast.feature_view import FeatureView
from feast.infra.online_stores.helpers import compute_entity_id
from feast.infra.online_stores.online_store import OnlineStore
from feast.infra.utils.hbase_utils import HbaseConstants, HBaseConnector
from feast.infra.utils.hbase_utils import HBaseConnector, HbaseConstants
from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
from feast.protos.feast.types.Value_pb2 import Value as ValueProto
from feast.repo_config import FeastConfigBaseModel, RepoConfig
Expand All @@ -23,15 +25,21 @@ class HbaseOnlineStoreConfig(FeastConfigBaseModel):
type: Literal["hbase"] = "hbase"
"""Online store type selector"""

host: str
host: StrictStr
"""Hostname of Hbase Thrift server"""

port: str
port: StrictStr
"""Port in which Hbase Thrift server is running"""

connection_pool_size: int = 4
"""Number of connections to Hbase Thrift server to keep in the connection pool"""

protocol: StrictStr = DEFAULT_PROTOCOL
"""Protocol used to communicate with Hbase Thrift server"""

transport: StrictStr = DEFAULT_TRANSPORT
"""Transport used to communicate with Hbase Thrift server"""


class HbaseOnlineStore(OnlineStore):
"""
Expand Down Expand Up @@ -59,6 +67,8 @@ def _get_conn(self, config: RepoConfig):
host=store_config.host,
port=int(store_config.port),
size=int(store_config.connection_pool_size),
protocol=store_config.protocol,
transport=store_config.transport,
)
return self._conn

Expand Down

0 comments on commit d272e75

Please sign in to comment.