Finalizes the DataBase(K, V) -> DataBase(V) change.
parent
14825f4edd
commit
10448d6b0b
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue