Skip to content

Commit

Permalink
Merge pull request #5 from JarbasHiveMind/release-0.0.2a2
Browse files Browse the repository at this point in the history
Release 0.0.2a2
  • Loading branch information
JarbasAl authored Dec 29, 2024
2 parents d375a98 + 6e9899f commit 896a500
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 14 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changelog

## [0.0.2a2](https://github.com/JarbasHiveMind/hivemind-redis-database/tree/0.0.2a2) (2024-12-29)

[Full Changelog](https://github.com/JarbasHiveMind/hivemind-redis-database/compare/0.0.2a1...0.0.2a2)

**Merged pull requests:**

- fix: missing hivemind entrypoint in setup.py [\#4](https://github.com/JarbasHiveMind/hivemind-redis-database/pull/4) ([JarbasAl](https://github.com/JarbasAl))

## [0.0.2a1](https://github.com/JarbasHiveMind/hivemind-redis-database/tree/0.0.2a1) (2024-12-29)

[Full Changelog](https://github.com/JarbasHiveMind/hivemind-redis-database/compare/0.0.1...0.0.2a1)

**Merged pull requests:**

- fix: missing hivemind entrypoint in setup.py [\#2](https://github.com/JarbasHiveMind/hivemind-redis-database/pull/2) ([JarbasAl](https://github.com/JarbasAl))



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
25 changes: 14 additions & 11 deletions hivemind_redis_database/__init__.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
from dataclasses import dataclass
from typing import List, Union, Optional, Iterable

import redis
from ovos_utils.log import LOG

from hivemind_plugin_manager.database import Client, AbstractDB, cast2client
from hivemind_plugin_manager.database import Client, AbstractRemoteDB, cast2client


class RedisDB(AbstractDB):
@dataclass
class RedisDB(AbstractRemoteDB):
"""Database implementation using Redis with RediSearch support."""

def __init__(self, host: str = "127.0.0.1", port: int = 6379, password: Optional[str] = None, redis_db: int = 0):
host: str = "127.0.0.1"
port: int = 6379
name: str = "clients"
subfolder: str = "hivemind-core"
password: Optional[str] = None
database_id: Optional[int] = None

def __post_init__(self):
"""
Initialize the RedisDB connection.
Args:
host: Redis server host.
port: Redis server port.
redis_db: Redis database index.
"""
self.redis = redis.StrictRedis(host=host, port=port, db=redis_db,
password=password if password else None,
self.redis = redis.StrictRedis(host=self.host, port=self.port, db=self.database_id,
password=self.password if self.password else None,
decode_responses=True)
# TODO - support for a proper search index

Expand Down
4 changes: 2 additions & 2 deletions hivemind_redis_database/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# START_VERSION_BLOCK
VERSION_MAJOR = 0
VERSION_MINOR = 0
VERSION_BUILD = 1
VERSION_ALPHA = 0
VERSION_BUILD = 2
VERSION_ALPHA = 2
# END_VERSION_BLOCK
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
py-redis
py-redis
hivemind-plugin-manager>=0.1.0,<1.0.0
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def required(requirements_file):
if pkg.strip() and not pkg.startswith("#")]


PLUGIN_ENTRY_POINT = 'hivemind-redis-db-plugin=hivemind_redis_database:RedisDB'

setup(
name='hivemind-redis-database',
Expand All @@ -48,6 +49,7 @@ def required(requirements_file):
license='Apache-2.0',
author='jarbasAi',
install_requires=required("requirements.txt"),
entry_points={'hivemind.database': PLUGIN_ENTRY_POINT},
author_email='[email protected]',
description='redis database plugin for hivemind-core'
)

0 comments on commit 896a500

Please sign in to comment.