Establish actual relationship of the Python binding's `LogEntry`, `StateMachine` types
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- distributed-systems
Hướng nghiên cứu
Bắt đầu bằng cách so sánh các khai báo tạm thời của AbstractLogEntry và AbstractStateMachine trong tệp .pyi với raftify/init.py đã cài đặt và nội dung của Python wheel. Tái hiện lỗi import đã cho, sau đó xác minh rằng hai kiểu này có sẵn từ raftify và hỗ trợ các mối quan hệ mẫu giữa SetCommand và HashStore mà không có lỗi import.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Ideally, the SetCommand and LogEntry in the sample code should be represented as shown below.
class SetCommand(AbstractLogEntry):
"""
Represent simple key-value command.
Use pickle to serialize the data.
"""
def __init__(self, key: str, value: str) -> None:
self.key = key
self.value = value
@override
def encode(self) -> bytes:
return pickle.dumps(self.__dict__)
@override
@classmethod
def decode(cls, packed: bytes) -> "SetCommand":
unpacked = pickle.loads(packed)
return cls(unpacked["key"], unpacked["value"])
class HashStore(AbstractStateMachine):
"""
A simple key-value store that stores data in memory.
Use pickle to serialize the data.
"""
def __init__(self):
self._store = dict()
self._loop = asyncio.get_running_loop()
def get(self, key: str) -> Optional[str]:
return self._store.get(key)
def as_dict(self) -> dict:
return self._store
@override
async def apply(self, msg: bytes) -> bytes:
message = SetCommand.decode(msg)
self._store[message.key] = message.value
return msg
@override
async def snapshot(self) -> bytes:
return pickle.dumps(self._store)
@override
async def restore(self, snapshot: bytes) -> None:
self._store = pickle.loads(snapshot)
However, for now, these two types are only temporarily defined in the .pyi file and are not actually included in the whl, resulting in an import error.
from raftify import AbstractLogEntry, AbstractStateMachine
ImportError: cannot import name 'AbstractLogEntry' from 'raftify' (/opt/homebrew/lib/python3.12/site-packages/raftify/__init__.py)
- Ngôn ngữ chính
- Rust
- Star
- 44
- Fork
- 14
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của lablup/raftify
-
integration-test
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
-
dx
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 32/100
-
feature log-storage snapshot
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Add unit tests for `MemStorage`Đang mởgood first issue log-storage test
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
-
feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
Tất cả issue của lablup/raftify
Issue tương tự
-
area:ui effort:medium enhancement P7 source:agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
marketing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Read a requested CodeRabbit PR review's findings with `coderabbit pullrequest --show-threads`Đang mởdocumentation priority: low tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
nledford/Ladderback#1823 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
psmux-resurrect: restoring a session with a numeric name puts its windows into the wrong session (`new-window -t 4` is read as window 4)Có thể đã có người làm @ealwanlee đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
psmux/psmux-plugins#47 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
Maintainer thường phản hồi trong vòng 1 ngày