wildland_catlib/
common.rs

1//
2// Wildland Project
3//
4// Copyright © 2022 Golem Foundation
5//
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License version 3 as published by
8// the Free Software Foundation.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
18use rustbreak::deser::Ron;
19use rustbreak::PathDatabase;
20use wildland_corex::catlib_service::error::CatlibResult;
21
22pub(crate) type CatLibData = std::collections::HashMap<String, String>;
23pub(crate) type StoreDb = PathDatabase<CatLibData, Ron>;
24
25pub trait Model {
26    fn delete(&mut self) -> CatlibResult<()>;
27    fn save(&self) -> CatlibResult<()>;
28    fn sync(&mut self) -> CatlibResult<()>;
29}
30
31pub fn get_version() -> &'static str {
32    env!("CARGO_PKG_VERSION")
33}