From 7e6c73307540ae70cdfa37ec4edc975001d9eb6b Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Sat, 1 Jun 2024 02:44:53 +0200 Subject: [PATCH] Next version of DODB, some API changes. --- shard.yml | 2 +- src/service.cr | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/shard.yml b/shard.yml index e1b8ada..d492b3f 100644 --- a/shard.yml +++ b/shard.yml @@ -31,8 +31,8 @@ dependencies: git: https://git.baguette.netlib.re/Baguette/baguette-crystal-base branch: master dodb: - git: https://git.baguette.netlib.re/Baguette/dodb.cr branch: master + git: https://git.baguette.netlib.re/Baguette/dodb.cr cbor: git: https://git.baguette.netlib.re/Baguette/crystal-cbor branch: master diff --git a/src/service.cr b/src/service.cr index 8a67d39..a450888 100644 --- a/src/service.cr +++ b/src/service.cr @@ -23,10 +23,10 @@ class AuthD::Service < IPC property configuration : Baguette::Configuration::Auth # DB and its indexes. - property users : DODB::DataBase(User) - property users_per_uid : DODB::Index(User) - property users_per_login : DODB::Index(User) - property users_per_email : DODB::Index(User) + property users : DODB::Storage::Cached(User) + property users_per_uid : DODB::Trigger(User) + property users_per_login : DODB::Trigger(User) + property users_per_email : DODB::Trigger(User) property logged_users : Hash(Int32, AuthD::User::Public) @@ -36,14 +36,14 @@ class AuthD::Service < IPC def initialize(@configuration) super() - @users = DODB::DataBase(User).new @configuration.storage + @users = DODB::Storage::Cached(User).new @configuration.storage @users_per_uid = @users.new_index "uid", &.uid.to_s @users_per_login = @users.new_index "login", &.login @users_per_email = @users.new_index "email" do |user| if mail = user.contact.email Base64.encode(mail).chomp else - "" + DODB.no_index end end