From e89d515f9bc70e937c0183587cba956e207348a0 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Thu, 21 Nov 2024 12:04:51 +0200 Subject: Add Recordable trait --- log_db/src/common.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/log_db/src/common.rs b/log_db/src/common.rs index d86e6c6..3590cf9 100644 --- a/log_db/src/common.rs +++ b/log_db/src/common.rs @@ -476,6 +476,14 @@ impl Record { } } +/// A trait that describes how to convert a data structure into a database `Record` and vice versa. +pub trait Recordable { + /// Convert the data structure implementing the `Recordable` trait into a database `Record`. + fn to_record(&self) -> Record; + /// Convert a database `Record` into the data structure implementing the `Recordable` trait. + fn from_record(record: &Record) -> Self; +} + pub fn get_secondary_memtable_index_by_field( sks: &Vec, field: &Field, -- cgit v1.3