Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ backend rewrite, towards making it more exchangeable
- Loading branch information
Showing
43 changed files
with
458 additions
and
905 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
server/lib/picky/backend/base.rb → server/lib/picky/backends/base.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module Picky | ||
|
||
module Backend | ||
module Backends | ||
|
||
class Base | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
server/lib/picky/backend/file/basic.rb → server/lib/picky/backends/file/basic.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module Picky | ||
|
||
module Backend | ||
module Backends | ||
|
||
# Handles all aspects of index files, such as dumping/loading. | ||
# | ||
|
2 changes: 1 addition & 1 deletion
2
server/lib/picky/backend/file/json.rb → server/lib/picky/backends/file/json.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module Picky | ||
|
||
module Backend | ||
module Backends | ||
|
||
module File | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
server/lib/picky/backend/file/marshal.rb → server/lib/picky/backends/file/marshal.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module Picky | ||
|
||
module Backend | ||
module Backends | ||
|
||
module File | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
server/lib/picky/backend/file/text.rb → server/lib/picky/backends/file/text.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module Picky | ||
|
||
module Backend | ||
module Backends | ||
|
||
module File | ||
|
||
|
4 changes: 2 additions & 2 deletions
4
server/lib/picky/backend/files.rb → server/lib/picky/backends/memory.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
server/lib/picky/backend/redis.rb → server/lib/picky/backends/redis.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module Picky | ||
|
||
module Backend | ||
module Backends | ||
|
||
# | ||
# | ||
|
2 changes: 1 addition & 1 deletion
2
server/lib/picky/backend/redis/basic.rb → server/lib/picky/backends/redis/basic.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module Picky | ||
|
||
module Backend | ||
module Backends | ||
|
||
class Redis | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
server/lib/picky/backend/redis/float_hash.rb → ...er/lib/picky/backends/redis/float_hash.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module Picky | ||
|
||
module Backend | ||
module Backends | ||
|
||
class Redis | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
server/lib/picky/backend/redis/list_hash.rb → server/lib/picky/backends/redis/list_hash.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module Picky | ||
|
||
module Backend | ||
module Backends | ||
|
||
class Redis | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...er/lib/picky/backend/redis/string_hash.rb → ...r/lib/picky/backends/redis/string_hash.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module Picky | ||
|
||
module Backend | ||
module Backends | ||
|
||
class Redis | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
module Picky | ||
|
||
module Indexed # :nodoc:all | ||
|
||
# An indexed bundle is a number of memory/redis | ||
# indexes that compose the indexes for a single category: | ||
# * core (inverted) index | ||
# * weights index | ||
# * similarity index | ||
# * index configuration | ||
# | ||
# Indexed refers to them being indexed. | ||
# This class notably offers the methods: | ||
# * load | ||
# * clear | ||
# | ||
# To (re)load or clear the current indexes. | ||
# | ||
class Bundle < Picky::Bundle | ||
|
||
# Get the ids for the given symbol. | ||
# | ||
# Returns a (potentially empty) array of ids. | ||
# | ||
def ids sym | ||
@inverted[sym] || [] | ||
end | ||
|
||
# Get a weight for the given symbol. | ||
# | ||
# Returns a number, or nil. | ||
# | ||
def weight sym | ||
@weights[sym] | ||
end | ||
|
||
# Get settings for this bundle. | ||
# | ||
# Returns an object. | ||
# | ||
def [] sym | ||
@configuration[sym] | ||
end | ||
|
||
# Loads all indexes. | ||
# | ||
# Loading loads index objects from the backend. | ||
# They should each respond to []. | ||
# | ||
def load | ||
load_inverted | ||
load_weights | ||
load_similarity | ||
load_configuration | ||
end | ||
|
||
# Loads the core index. | ||
# | ||
def load_inverted | ||
self.inverted = @backend.load_inverted | ||
end | ||
# Loads the weights index. | ||
# | ||
def load_weights | ||
self.weights = @backend.load_weights | ||
end | ||
# Loads the similarity index. | ||
# | ||
def load_similarity | ||
self.similarity = @backend.load_similarity | ||
end | ||
# Loads the configuration. | ||
# | ||
def load_configuration | ||
self.configuration = @backend.load_configuration | ||
end | ||
|
||
# Clears all indexes. | ||
# | ||
def clear | ||
clear_inverted | ||
clear_weights | ||
clear_similarity | ||
clear_configuration | ||
end | ||
|
||
# Clears the core index. | ||
# | ||
def clear_inverted | ||
inverted.clear | ||
end | ||
# Clears the weights index. | ||
# | ||
def clear_weights | ||
weights.clear | ||
end | ||
# Clears the similarity index. | ||
# | ||
def clear_similarity | ||
similarity.clear | ||
end | ||
# Clears the configuration. | ||
# | ||
def clear_configuration | ||
configuration.clear | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.