Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
204f726
Update usage error for server to use remove data folder URL
CGodiksen Nov 15, 2025
6caa15f
Re-order deployment options
CGodiksen Nov 15, 2025
2b73043
Add EnvironmentVar to storage errors
CGodiksen Nov 15, 2025
7d979bd
Update open_object_store to use remote_url instead of StorageConfigur…
CGodiksen Nov 15, 2025
ef80caa
Be specific with what objects stores are supported
CGodiksen Nov 15, 2025
e41a649
Rename to open_remote_url for consistency with open_local_url
CGodiksen Nov 15, 2025
f2c5722
No longer use Manager::register_node
CGodiksen Nov 15, 2025
f920778
Remove ManagerMetadata and StorageConfiguration from protobuf
CGodiksen Nov 15, 2025
118b2f9
Remove argument_to_storage_configuration since it is unused
CGodiksen Nov 15, 2025
b29e51d
Remove encode_node and decode_node_metadata since they are unused.
CGodiksen Nov 15, 2025
ad61616
Remove NodeMetadata from protocol buffers since it is no longer used
CGodiksen Nov 15, 2025
6b78c8e
Update DataFolders tests to no longer mention manager
CGodiksen Nov 15, 2025
6c35561
Add file structure for cluster struct
CGodiksen Nov 15, 2025
c94e16a
Move data_folder.rs into module folder
CGodiksen Nov 15, 2025
4c6c459
Move and rename ManagerMetadata trait to ClusterMetadata
CGodiksen Nov 15, 2025
ea362f4
Added basic structure for new Cluster struct
CGodiksen Nov 15, 2025
dcc17d2
Add method to get the most capable query node
CGodiksen Nov 16, 2025
da31661
Add cluster_do_get to new cluster struct
CGodiksen Nov 16, 2025
132179f
Add cluster_do_action to new cluster struct
CGodiksen Nov 16, 2025
ca085f0
Create and register cluster tables when cluster is created
CGodiksen Nov 16, 2025
595d6a7
Add unit tests for new cluster struct
CGodiksen Nov 16, 2025
f13fffc
Save node automatically when creating cluster object
CGodiksen Nov 16, 2025
dc04a65
Put new Cluster struct in ClusterMode::MultiNode
CGodiksen Nov 16, 2025
f062201
Move validate_local_tables_exist_remotely to new Cluster struct
CGodiksen Nov 16, 2025
42015d4
Move validate_normal_tables to new Cluster struct
CGodiksen Nov 16, 2025
544fea9
Move validate_time_series_tables to new Cluster struct
CGodiksen Nov 16, 2025
eb6e7b9
Move retrieve_and_create_tables to new Cluster struct
CGodiksen Nov 16, 2025
518e367
Move temp_dir out of test util function
CGodiksen Nov 16, 2025
87886c2
Add test util method to create context
CGodiksen Nov 16, 2025
8ccbd6d
Use a reference for the TempDir to avoid dropping it
CGodiksen Nov 16, 2025
f00f511
Add test for retrieving and creating missing local normal table
CGodiksen Nov 16, 2025
78bc426
Add test for trying to retrieve and create tables when a table exists…
CGodiksen Nov 16, 2025
39d3b85
Now also testing that we accept tables with same name and schema
CGodiksen Nov 16, 2025
8a4d837
Add test for retrieving and creating missing local time series table
CGodiksen Nov 16, 2025
9b5b7ab
Add test for trying to retrieve and create a time series table with t…
CGodiksen Nov 16, 2025
d3f5eed
Add test for trying to retrieve and create tables with tables that ar…
CGodiksen Nov 16, 2025
aee496a
Add documentation to test util functions
CGodiksen Nov 16, 2025
c04516f
Use constants for table names where possible
CGodiksen Nov 16, 2025
c4dc0b8
Add method to remove node and add unit test
CGodiksen Nov 16, 2025
9bd3735
Use method to remove node when process is stopped
CGodiksen Nov 16, 2025
b95ff67
Use method to remove node when KillNode is called
CGodiksen Nov 16, 2025
7bed183
query_node() no longer uses &mut self
CGodiksen Nov 16, 2025
30ce062
Move get_flight_info to server remote
CGodiksen Nov 16, 2025
cc85ab1
Reorder get_flight_info to extract cloud node first
CGodiksen Nov 16, 2025
59e9a49
Fix bug where cluster operations was executed on all nodes except onl…
CGodiksen Nov 17, 2025
00478ea
Add method to check if cluster key is in request metadata
CGodiksen Nov 17, 2025
f8c3681
Use new methods to handle potentially creating tables in entire cluster
CGodiksen Nov 17, 2025
8d70670
Add cluster methods to create table in remote data folder and in peer…
CGodiksen Nov 17, 2025
adae825
Add method to server remote to handle potentially dropping tables in …
CGodiksen Nov 17, 2025
524fdde
Add method to drop table in remote data folder and in each peer node
CGodiksen Nov 17, 2025
9ec8d09
Remove unused startup functions in manager
CGodiksen Nov 17, 2025
fb42b50
Remove unused metadata management in manager
CGodiksen Nov 17, 2025
e87e1cc
Remove duplicated methods for table validation from old Manager struct
CGodiksen Nov 17, 2025
547d238
Remove unused actions to register and remove nodes
CGodiksen Nov 17, 2025
a96945c
Remove unused Manager struct from server
CGodiksen Nov 17, 2025
2ebf2b3
Allow async fn in trait by disabling warning
CGodiksen Nov 17, 2025
6db84d9
Use allow to remote clippy warnings
CGodiksen Nov 17, 2025
828c8a2
Use Statement::DropSecret instead of Statement::Notify for Vacuum
CGodiksen Nov 17, 2025
2eb6cfd
Add support for parsing VACUUM CLUSTER statements
CGodiksen Nov 17, 2025
d5f9ebd
Add more unit tests for testing correct VACUUM CLUSTER statements
CGodiksen Nov 17, 2025
1d0af6a
Add more unit tests for testing incorrect VACUUM CLUSTER statements
CGodiksen Nov 17, 2025
0c8c9ca
Add util method to parse table names
CGodiksen Nov 18, 2025
92cd70d
Update doc comments to add new TRUNCATE statements
CGodiksen Nov 18, 2025
71366a3
Add custom parsing for TRUNCATE statements to support TRUNCATE CLUSTER
CGodiksen Nov 18, 2025
6461c94
Add unit tests that ensure the correct TRUNCATE CLUSTER syntax works
CGodiksen Nov 18, 2025
80a3ab1
Add unit tests that ensure the wrong TRUNCATE CLUSTER syntax fails
CGodiksen Nov 18, 2025
468ea9d
Add method to truncate entire cluster if CLUSTER is included in state…
CGodiksen Nov 18, 2025
0fcd72f
Add method to vacuum entire cluster if CLUSTER is included in statement
CGodiksen Nov 18, 2025
1a5779c
Implement cluster methods to vacuum and truncate cluster table
CGodiksen Nov 18, 2025
8080524
Remove TABLE from TRUNCATE TABLE
CGodiksen Nov 18, 2025
398a4bc
Move for loop down to avoid sending a request for each table when clu…
CGodiksen Nov 18, 2025
62de621
Move for loop down to avoid sending a request for each table when clu…
CGodiksen Nov 18, 2025
134ba38
Update the NodeType action to return SingleEdge, ClusterEdge, or Clus…
CGodiksen Nov 18, 2025
865a924
Remove Node enum and instead just use URL when connecting to Client
CGodiksen Nov 18, 2025
afa2b5d
Use URL instead of Node in C-API
CGodiksen Nov 18, 2025
2f0d682
Use str url instead of Node class when connecting to Client
CGodiksen Nov 18, 2025
1fdfcf7
Add modelardb_type method to Operations API
CGodiksen Nov 18, 2025
07f25a0
Implement C-API method to get ModelarDB type of Operations instance
CGodiksen Nov 18, 2025
7f663b1
Implement method on Python interface to get ModelarDB type
CGodiksen Nov 18, 2025
cb3be71
Use ModelarDBType enum on Python side for return value of modelardb_t…
CGodiksen Nov 18, 2025
8e015b4
Remove manager from cluster Docker Compose setup
CGodiksen Nov 20, 2025
3419b4c
Add one more edge and cloud node to lcluster setup
CGodiksen Nov 20, 2025
6926178
No longer use base service to avoid multiple builds
CGodiksen Nov 20, 2025
e312937
Update Docker section in docs to no longer mention manager
CGodiksen Nov 20, 2025
5d407fc
Update dev docs to match the new module structure
CGodiksen Nov 20, 2025
5c30230
Update user docs to no longer mention the manager
CGodiksen Nov 20, 2025
51b6db0
Remove modelardb_manager crate
CGodiksen Nov 20, 2025
3e8b56f
Remove unused dependency and build step
CGodiksen Nov 20, 2025
ef7506f
Refactor C-API to use int pointer for modelardb_type function
CGodiksen Nov 26, 2025
b399dde
Refactor the Python API to match the use of int pointer in modelardb_…
CGodiksen Nov 26, 2025
6ce3153
Use release build instead of debug build in Docker cluster setup
CGodiksen Nov 27, 2025
592455b
Make it possible to drop multiple cluster tables at the same time
CGodiksen Nov 28, 2025
b7812e9
Refactor handling of drop table in server remote to match new cluster…
CGodiksen Nov 28, 2025
9ad7db1
Update Cluster documentation to only mention peer nodes
CGodiksen Nov 28, 2025
f3746e5
Remove deleted file from toctree
CGodiksen Nov 28, 2025
aacbf52
Update based on comments from @chrthomsen
CGodiksen Nov 30, 2025
f77d5a1
Merge branch 'main' into dev/remove-manager
CGodiksen Dec 11, 2025
0c76f27
Fix field access after merge
CGodiksen Dec 11, 2025
c9c2f3e
Wrap large enum variant in Box
CGodiksen Dec 12, 2025
fd2ed1c
Update based on comments from @skejserjensen
CGodiksen Dec 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build-lint-test-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ jobs:
mv target/release/modelardb$SUFFIX modelardb_$RUST_TRIPLE/modelardb$SUFFIX
mv target/release/modelardbb$SUFFIX modelardb_$RUST_TRIPLE/modelardbb$SUFFIX
mv target/release/modelardbd$SUFFIX modelardb_$RUST_TRIPLE/modelardbd$SUFFIX
mv target/release/modelardbm$SUFFIX modelardb_$RUST_TRIPLE/modelardbm$SUFFIX

# Upload Binaries.
- name: Artifact Upload
Expand Down
22 changes: 1 addition & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

FROM rust:latest

ARG BUILD_PROFILE=dev
ARG BUILD_PROFILE=release

WORKDIR /usr/src/app

Expand All @@ -24,4 +24,4 @@ RUN apt-get update && apt-get install -y protobuf-compiler

RUN cargo build --profile $BUILD_PROFILE

CMD ["target/debug/modelardbd", "edge", "data"]
CMD ["target/release/modelardbd", "edge", "data"]
21 changes: 0 additions & 21 deletions crates/modelardb_embedded/bindings/python/docs/api/node.rst

This file was deleted.

1 change: 0 additions & 1 deletion crates/modelardb_embedded/bindings/python/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ API
api/modelardb
api/error_bound
api/ffi_array
api/node
api/operations
api/table

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

from .error_bound import AbsoluteErrorBound, RelativeErrorBound
from .ffi_array import FFIArray
from .node import Server, Manager
from .operations import (
Aggregate,
ModelarDBType,
Operations,
open_memory,
open_local,
Expand Down
39 changes: 0 additions & 39 deletions crates/modelardb_embedded/bindings/python/modelardb/node.py

This file was deleted.

55 changes: 40 additions & 15 deletions crates/modelardb_embedded/bindings/python/modelardb/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import sys
import platform
import warnings
Expand All @@ -26,12 +25,20 @@
from pyarrow import MapArray, RecordBatch, Schema, StringArray
from pyarrow.cffi import ffi

from .node import Server, Manager
from .error_bound import AbsoluteErrorBound
from .table import NormalTable, TimeSeriesTable
from .ffi_array import FFIArray


class ModelarDBType(Enum):
"""Different types of ModelarDB instances that the Operations API can interact with."""

SingleEdge = 0
ClusterEdge = 1
ClusterCloud = 2
DataFolder = 3


class Aggregate(Enum):
"""Aggregate operations supported by :meth:`Operations.read`."""

Expand Down Expand Up @@ -120,12 +127,15 @@ def __find_library(build: str) -> str:
char* access_key_ptr,
char* container_name_ptr);

void* modelardb_embedded_connect(char* node_url_ptr,
bool is_server_node);
void* modelardb_embedded_connect(char* url_ptr);

int modelardb_embedded_close(void* maybe_operations_ptr,
bool is_data_folder);

int modelardb_embedded_modelardb_type(void* maybe_operations_ptr,
bool is_data_folder,
int* modelardb_type_ptr);

int modelardb_embedded_create(void* maybe_operations_ptr,
bool is_data_folder,
char* table_name_ptr,
Expand Down Expand Up @@ -322,19 +332,17 @@ def open_azure(cls, account_name: str, access_key: str, container_name: str):
return self

@classmethod
def connect(cls, node: Server | Manager):
def connect(cls, url: str):
"""Create a connection to an :obj:`Operations` node.

:param node: The ModelarDB node to connect to.
:type node: Server | Manager
:param url: The URL of the ModelarDB node to connect to.
:type url: str
"""
self: Operations = cls()

node_url_ptr = ffi.new("char[]", bytes(node.url, "UTF-8"))
url_ptr = ffi.new("char[]", bytes(url, "UTF-8"))

self.__operations_ptr = self.__library.modelardb_embedded_connect(
node_url_ptr, isinstance(node, Server)
)
self.__operations_ptr = self.__library.modelardb_embedded_connect(url_ptr)
self.__is_data_folder = False

if self.__operations_ptr == ffi.NULL:
Expand All @@ -349,6 +357,23 @@ def __del__(self):
)
self.__check_return_code_and_raise_error(return_code)

def modelardb_type(self) -> ModelarDBType:
"""Returns the type of the ModelarDB instance that :obj:`Operations` is connected to.

:return: The type of the ModelarDB instance.
:rtype: ModelarDBType
"""
modelardb_type_int_ffi = ffi.new("int*")

return_code = self.__library.modelardb_embedded_modelardb_type(
self.__operations_ptr,
self.__is_data_folder,
modelardb_type_int_ffi
)
self.__check_return_code_and_raise_error(return_code)

return ModelarDBType(modelardb_type_int_ffi[0])

def create(self, table_name: str, table_type: NormalTable | TimeSeriesTable):
"""Creates a table with `table_name`, `schema`, and `error_bounds`.

Expand Down Expand Up @@ -847,10 +872,10 @@ def open_azure(account_name: str, access_key: str, container_name: str) -> Opera
return Operations.open_azure(account_name, access_key, container_name)


def connect(node: Server | Manager) -> Operations:
def connect(url: str) -> Operations:
"""Create a connection to an :obj:`Operations` node.

:param node: The ModelarDB node to connect to.
:type node: Server | Manager
:param url: The URL of the ModelarDB node to connect to.
:type url: str
"""
return Operations.connect(node)
return Operations.connect(url)
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import pyarrow
from modelardb import (
Aggregate,
ModelarDBType,
AbsoluteErrorBound,
TimeSeriesTable,
NormalTable,
Expand All @@ -42,6 +43,12 @@ def test_data_folder_init(self):
new_data_folder = Operations.open_local(temp_dir)
self.assertEqual(data_folder.tables(), new_data_folder.tables())

def test_data_folder_modelardb_type(self):
with TemporaryDirectory() as temp_dir:
data_folder = Operations.open_local(temp_dir)

self.assertEqual(data_folder.modelardb_type(), ModelarDBType.DataFolder)

def test_data_folder_create_normal_table(self):
with TemporaryDirectory() as temp_dir:
data_folder = Operations.open_local(temp_dir)
Expand Down
56 changes: 39 additions & 17 deletions crates/modelardb_embedded/src/capi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use tokio::runtime::Runtime;

use crate::error::{ModelarDbEmbeddedError, Result};
use crate::operations::Operations;
use crate::operations::client::{Client, Node};
use crate::operations::client::Client;
use crate::operations::data_folder::DataFolderDataSink;
use crate::record_batch_stream_to_record_batch;
use crate::{Aggregate, TableType};
Expand Down Expand Up @@ -197,29 +197,20 @@ unsafe fn open_azure(
Ok(data_folder)
}

/// Creates a [`Client`] that is connected to the Apache Arrow Flight server URL in `node_url_ptr`
/// Creates a [`Client`] that is connected to the Apache Arrow Flight server URL in `url_ptr`
/// and returns a pointer to the [`Client`] or a zero-initialized pointer if an error occurs.
/// Assumes `node_url_ptr` points to a valid C string.
/// Assumes `url_ptr` points to a valid C string.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn modelardb_embedded_connect(
node_url_ptr: *const c_char,
is_server_node: bool,
) -> *const c_void {
let maybe_client = unsafe { connect(node_url_ptr, is_server_node) };
pub unsafe extern "C" fn modelardb_embedded_connect(url_ptr: *const c_char) -> *const c_void {
let maybe_client = unsafe { connect(url_ptr) };
set_error_and_return_value_ptr(maybe_client)
}

/// See documentation for [`modelardb_embedded_connect()`].
unsafe fn connect(node_url_ptr: *const c_char, is_server_node: bool) -> Result<Client> {
let node_url_str = unsafe { c_char_ptr_to_str(node_url_ptr)? };

let node = if is_server_node {
Node::Server(node_url_str.to_owned())
} else {
Node::Manager(node_url_str.to_owned())
};
unsafe fn connect(url_ptr: *const c_char) -> Result<Client> {
let url_str = unsafe { c_char_ptr_to_str(url_ptr)? };

TOKIO_RUNTIME.block_on(Client::connect(node))
TOKIO_RUNTIME.block_on(Client::connect(url_str))
}

/// Moves the value in `maybe_value` to a [`Box`] and returns a pointer to it if `maybe_value` is
Expand Down Expand Up @@ -266,6 +257,37 @@ pub unsafe extern "C" fn modelardb_embedded_close(
}
}

/// Returns the ModelarDB type of the [`DataFolder`] or [`Client`] in `maybe_operations_ptr`.
/// Assumes `maybe_operations_ptr` points to a [`DataFolder`] or [`Client`] and `modelardb_type_ptr`
/// is a valid pointer to enough memory for a 32-bit signed integer.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn modelardb_embedded_modelardb_type(
maybe_operations_ptr: *mut c_void,
is_data_folder: bool,
modelardb_type_ptr: *mut c_int,
) -> c_int {
let maybe_unit =
unsafe { modelardb_type(maybe_operations_ptr, is_data_folder, modelardb_type_ptr) };

set_error_and_return_code(maybe_unit)
}

/// See documentation for [`modelardb_embedded_modelardb_type()`].
unsafe fn modelardb_type(
maybe_operations_ptr: *mut c_void,
is_data_folder: bool,
modelardb_type_ptr: *mut c_int,
) -> Result<()> {
let modelardb = unsafe { c_void_to_operations(maybe_operations_ptr, is_data_folder)? };

let modelardb_type = TOKIO_RUNTIME.block_on(modelardb.modelardb_type())?;
let modelardb_type_int = modelardb_type as i32;

unsafe { modelardb_type_ptr.write(modelardb_type_int) };

Ok(())
}

/// Creates a table with the name in `table_name_ptr`, the schema in `schema_ptr`, and the error
/// bounds in `error_bounds_ptr` in the [`DataFolder`] or [`Client`] in `maybe_operations_ptr`.
/// Assumes `maybe_operations_ptr` points to a [`DataFolder`] or [`Client`]; `table_name_ptr` points
Expand Down
Loading