15#ifndef ACTIONENGINE_PYBIND11_ACTIONENGINE_CHUNK_STORE_H_
16#define ACTIONENGINE_PYBIND11_ACTIONENGINE_CHUNK_STORE_H_
25#include <absl/status/status.h>
26#include <absl/status/statusor.h>
27#include <absl/time/time.h>
28#include <pybind11/cast.h>
29#include <pybind11/detail/type_caster_base.h>
30#include <pybind11/pybind11.h>
31#include <pybind11/pytypes.h>
32#include <pybind11_abseil/absl_casters.h>
33#include <pybind11_abseil/status_caster.h>
34#include <pybind11_abseil/statusor_caster.h>
39namespace act::pybindings {
41namespace py = ::pybind11;
43class PyChunkStore final :
public ChunkStore, py::trampoline_self_life_support {
46 using ChunkStore::ChunkStore;
48 PyChunkStore() : ChunkStore() {}
50 absl::StatusOr<Chunk> Get(int64_t seq, absl::Duration timeout)
override;
52 absl::StatusOr<Chunk> GetByArrivalOrder(int64_t seq,
53 absl::Duration timeout)
override;
55 absl::StatusOr<std::reference_wrapper<const Chunk>> GetRef(
56 int64_t seq, absl::Duration timeout)
override;
58 absl::StatusOr<std::reference_wrapper<const Chunk>> GetRefByArrivalOrder(
59 int64_t seq, absl::Duration timeout)
override;
61 absl::StatusOr<std::optional<Chunk>> Pop(int64_t seq)
override;
63 absl::Status Put(int64_t seq, Chunk chunk,
bool final)
override;
65 absl::Status CloseWritesWithStatus(absl::Status status)
override;
67 absl::StatusOr<size_t> Size()
override;
69 absl::StatusOr<bool> Contains(int64_t seq)
override;
71 absl::Status SetId(std::string_view
id)
override;
73 [[nodiscard]] std::string_view GetId()
const override;
75 absl::StatusOr<int64_t> GetSeqForArrivalOffset(
76 int64_t arrival_offset)
override;
78 absl::StatusOr<int64_t> GetFinalSeq()
override;
81void BindChunkStoreReaderOptions(
82 py::handle scope, std::string_view name =
"ChunkStoreReaderOptions");
84void BindChunkStore(py::handle scope, std::string_view name =
"ChunkStore");
86void BindLocalChunkStore(py::handle scope,
87 std::string_view name =
"LocalChunkStore");
89py::module_ MakeChunkStoreModule(py::module_ scope,
90 std::string_view module_name =
"chunk_store");
93namespace pybind11::detail {
95class type_caster<std::unique_ptr<act::ChunkStore>>
96 :
public type_caster_base<std::unique_ptr<act::ChunkStore>> {};
An abstract interface for raw data storage and retrieval for ActionEngine nodes.
ActionEngine data structures used to implement actions and nodes (data streams).