Skip to content
Snippets Groups Projects
Commit 63ea017c authored by Georgy Moshkin's avatar Georgy Moshkin :speech_balloon:
Browse files

feat: proc_version_info

parent 0ad93b18
No related branches found
No related tags found
No related merge requests found
Pipeline #31485 failed
use std::borrow::Cow;
use tarantool::proc;
pub const PICODATA_VERSION: &'static str = std::env!("GIT_DESCRIBE");
pub const PROC_API_VERSION: &'static str = "0.1.0";
////////////////////////////////////////////////////////////////////////////////
// VersionInfo
////////////////////////////////////////////////////////////////////////////////
#[derive(Clone, Debug, ::serde::Serialize, ::serde::Deserialize)]
pub struct VersionInfo<'a> {
pub picodata_version: Cow<'a, str>,
pub proc_api_version: Cow<'a, str>,
}
impl<'a> tarantool::tuple::Encode for VersionInfo<'a> {}
impl<'a> tarantool::proc::Return for VersionInfo<'a> {
#[inline(always)]
fn ret(self, ctx: tarantool::tuple::FunctionCtx) -> std::os::raw::c_int {
tarantool::proc::ReturnMsgpack(self).ret(ctx)
}
}
impl VersionInfo<'static> {
pub fn current() -> Self {
Self {
picodata_version: PICODATA_VERSION.into(),
proc_api_version: PROC_API_VERSION.into(),
}
}
}
////////////////////////////////////////////////////////////////////////////////
// proc_veresion_info
////////////////////////////////////////////////////////////////////////////////
#[proc]
pub fn proc_version_info() -> VersionInfo<'static> {
VersionInfo::current()
}
......@@ -3,6 +3,7 @@
#![allow(clippy::let_and_return)]
#![allow(clippy::needless_return)]
#![allow(clippy::unwrap_or_default)]
#![allow(clippy::redundant_static_lifetimes)]
use serde::{Deserialize, Serialize};
use ::raft::prelude as raft;
......@@ -41,6 +42,7 @@ pub mod discovery;
pub mod error_injection;
pub mod failure_domain;
pub mod governor;
pub mod info;
pub mod instance;
pub mod ipc;
pub mod kvcell;
......
......@@ -67,7 +67,7 @@ pub(crate) fn setup(args: &args::Run) {
"},
{
const _: () = assert!(str_eq(env!("CARGO_PKG_VERSION"), "23.12.0"));
env!("GIT_DESCRIBE")
crate::info::PICODATA_VERSION
},
);
......
......@@ -320,3 +320,8 @@ def test_governor_notices_restarts(instance: Instance):
check_vshard_configured(instance)
assert instance.current_grade() == dict(variant="Online", incarnation=2)
def test_proc_version_info(instance: Instance):
info = instance.call(".proc_version_info")
assert info.keys() == set(["picodata_version", "proc_api_version"]) # type: ignore
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment