Finalizes the DataBase(K, V) -> DataBase(V) change.

remotes/1708105384931250775/master
Luka Vandervelden 2019-12-28 03:24:05 +01:00
parent 14825f4edd
commit 10448d6b0b
2 changed files with 4 additions and 5 deletions

View File

@ -88,7 +88,7 @@ class PrimitiveShip
]
end
class DODB::SpecDataBase < DODB::DataBase(String, Ship)
class DODB::SpecDataBase < DODB::DataBase(Ship)
def initialize(storage_ext = "")
storage_dir = "test-storage#{storage_ext}"
@ -306,7 +306,7 @@ describe "DODB::DataBase" do
end
it "migrates properly" do
old_db = DODB::DataBase(String, PrimitiveShip).new "test-storage-migration-origin"
old_db = DODB::DataBase(PrimitiveShip).new "test-storage-migration-origin"
old_ships_by_name = old_db.new_index "name", &.name
old_ships_by_class = old_db.new_partition "class", &.class_name

View File

@ -3,7 +3,7 @@ require "json"
require "./dodb/*"
class DODB::DataBase(K, V)
class DODB::DataBase(V)
@indexers = [] of Indexer(V)
def initialize(@directory_name : String)
@ -67,14 +67,13 @@ class DODB::DataBase(K, V)
index.not_nil!.as(DODB::Index).get key
end
# FIXME: Is this “key” really a K, not just a String?
def get_partition(table_name : String, partition_name : String)
partition = @indexers.find &.name.==(table_name)
partition.not_nil!.as(DODB::Partition).get partition_name
end
def get_tags(name, key : K)
def get_tags(name, key : String)
partition = @indexers.find &.name.==(name)
partition.not_nil!.as(DODB::Tags).get name, key