diff --git a/README.md b/README.md index 2701f7b..8bdacf9 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ Coming Soon import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Socket "github.com/realTristan/Hermes/socket" + Socket "github.com/realTristan/Hermes/cloud/socket" ) func main() { @@ -161,7 +161,7 @@ func main() { # Websocket API ## Cache -### [cache.set](https://github.com/realTristan/Hermes/blob/master/socket/handlers/set.go) +### [cache.set](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/set.go) #### About ``` @@ -187,7 +187,7 @@ Set a value in the cache with the corresponding key. } ``` -### [cache.delete](https://github.com/realTristan/Hermes/blob/master/socket/handlers/delete.go) +### [cache.delete](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/delete.go) #### About ``` @@ -210,7 +210,7 @@ Delete the provided key, and the data correlated to it from the cache. } ``` -### [cache.get](https://github.com/realTristan/Hermes/blob/master/socket/handlers/get.go) +### [cache.get](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/get.go) #### About ``` @@ -233,7 +233,7 @@ Get data from the cache using a key. } ``` -### [cache.keys](https://github.com/realTristan/Hermes/blob/master/socket/handlers/keys.go) +### [cache.keys](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/keys.go) #### About ``` @@ -255,7 +255,7 @@ Get all of the keys in the cache. } ``` -### [cache.values](https://github.com/realTristan/Hermes/blob/master/socket/handlers/values.go) +### [cache.values](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/values.go) #### About ``` @@ -277,7 +277,7 @@ Get all of the values in the cache. } ``` -### [cache.length](https://github.com/realTristan/Hermes/blob/master/socket/handlers/length.go) +### [cache.length](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/length.go) #### About ``` @@ -299,7 +299,7 @@ Get the amount of keys stored in the cache. } ``` -### [cache.clean](https://github.com/realTristan/Hermes/blob/master/socket/handlers/clean.go) +### [cache.clean](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/clean.go) #### About ``` @@ -321,7 +321,7 @@ Clean all the data in the cache, and full-text storage. } ``` -### [cache.info](https://github.com/realTristan/Hermes/blob/master/socket/handlers/info.go) +### [cache.info](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/info.go) #### About ``` @@ -343,7 +343,7 @@ Get the cache and full-text storage statistics. } ``` -### [cache.exists](https://github.com/realTristan/Hermes/blob/master/socket/handlers/exists.go) +### [cache.exists](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/exists.go) #### About ``` @@ -368,7 +368,7 @@ Get whether a key exists in the cache. ## Full-Text -### [ft.init](https://github.com/realTristan/Hermes/blob/master/socket/handlers/init.go) +### [ft.init](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/init.go) #### About ``` @@ -393,7 +393,7 @@ Intialize the full text cache. } ``` -### [ft.clean](https://github.com/realTristan/Hermes/blob/master/socket/handlers/clean.go) +### [ft.clean](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/clean.go) #### About ``` @@ -415,7 +415,7 @@ Clean all of the data in the full-text storage. } ``` -### [ft.search](https://github.com/realTristan/Hermes/blob/master/socket/handlers/search.go) +### [ft.search](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/search.go) #### About ``` @@ -440,7 +440,7 @@ Search for a query in the full-text storage. } ``` -### [ft.search.oneword](https://github.com/realTristan/Hermes/blob/master/socket/handlers/search.go) +### [ft.search.oneword](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/search.go) #### About ``` @@ -465,7 +465,7 @@ Search for a single word in the full-text storage. } ``` -### [ft.search.values](https://github.com/realTristan/Hermes/blob/master/socket/handlers/search.go) +### [ft.search.values](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/search.go) #### About ``` @@ -492,7 +492,7 @@ Search in the cache data values. (Slower) } ``` -### [ft.search.withkey](https://github.com/realTristan/Hermes/blob/master/socket/handlers/search.go) +### [ft.search.withkey](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/search.go) #### About ``` @@ -517,7 +517,7 @@ Search in the cache data values for a specific key. } ``` -### [ft.maxbytes.set](https://github.com/realTristan/Hermes/blob/master/socket/handlers/fulltext.go) +### [ft.maxbytes.set](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/fulltext.go) #### About ``` @@ -540,7 +540,7 @@ Set the maximum full-text storage size in bytes. } ``` -### [ft.maxlength.set](https://github.com/realTristan/Hermes/blob/master/socket/handlers/fulltext.go) +### [ft.maxlength.set](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/fulltext.go) #### About ``` @@ -563,7 +563,7 @@ Set the maximum full-text storage words allowed to be stored. } ``` -### [ft.storage](https://github.com/realTristan/Hermes/blob/master/socket/handlers/fulltext.go) +### [ft.storage](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/fulltext.go) #### About ``` @@ -585,7 +585,7 @@ Get the current full-text storage. } ``` -### [ft.storage.size](https://github.com/realTristan/Hermes/blob/master/socket/handlers/fulltext.go) +### [ft.storage.size](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/fulltext.go) #### About ``` @@ -607,7 +607,7 @@ Get the current full-text storage size in bytes. } ``` -### [ft.storage.length](https://github.com/realTristan/Hermes/blob/master/socket/handlers/fulltext.go) +### [ft.storage.length](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/fulltext.go) #### About ``` @@ -629,7 +629,7 @@ Get the current full-text storage length. } ``` -### [ft.isinitialized](https://github.com/realTristan/Hermes/blob/master/socket/handlers/fulltext.go) +### [ft.isinitialized](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/fulltext.go) #### About ``` @@ -651,7 +651,7 @@ Get whether the full-text storage has been initialized. } ``` -### [ft.indices.sequence](https://github.com/realTristan/Hermes/blob/master/socket/handlers/indices.go) +### [ft.indices.sequence](https://github.com/realTristan/Hermes/blob/master/cloud/socket/handlers/indices.go) #### About ``` diff --git a/api/handlers/clean.go b/cloud/api/handlers/clean.go similarity index 95% rename from api/handlers/clean.go rename to cloud/api/handlers/clean.go index 0d47d51..fda0dd9 100644 --- a/api/handlers/clean.go +++ b/cloud/api/handlers/clean.go @@ -3,7 +3,7 @@ package handlers import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // Clean is a function that returns a fiber context handler function for cleaning the regular cache. diff --git a/api/handlers/delete.go b/cloud/api/handlers/delete.go similarity index 93% rename from api/handlers/delete.go rename to cloud/api/handlers/delete.go index 950ef35..47cf8d0 100644 --- a/api/handlers/delete.go +++ b/cloud/api/handlers/delete.go @@ -3,7 +3,7 @@ package handlers import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // Delete is a handler function that returns a fiber context handler function for deleting a key from the cache. diff --git a/api/handlers/exists.go b/cloud/api/handlers/exists.go similarity index 94% rename from api/handlers/exists.go rename to cloud/api/handlers/exists.go index 5f0279b..9a9f031 100644 --- a/api/handlers/exists.go +++ b/cloud/api/handlers/exists.go @@ -3,7 +3,7 @@ package handlers import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // Exists is a handler function that returns a fiber context handler function for checking if a key exists in the cache. diff --git a/api/handlers/fulltext.go b/cloud/api/handlers/fulltext.go similarity index 99% rename from api/handlers/fulltext.go rename to cloud/api/handlers/fulltext.go index c77cb35..e2ee110 100644 --- a/api/handlers/fulltext.go +++ b/cloud/api/handlers/fulltext.go @@ -5,7 +5,7 @@ import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // FTIsInitialized is a handler function that returns a fiber context handler function for checking if the full-text search is initialized. diff --git a/api/handlers/get.go b/cloud/api/handlers/get.go similarity index 96% rename from api/handlers/get.go rename to cloud/api/handlers/get.go index 33153d8..815e40e 100644 --- a/api/handlers/get.go +++ b/cloud/api/handlers/get.go @@ -5,7 +5,7 @@ import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // Get is a handler function that returns a fiber context handler function for getting a value from the cache. diff --git a/api/handlers/indices.go b/cloud/api/handlers/indices.go similarity index 92% rename from api/handlers/indices.go rename to cloud/api/handlers/indices.go index 9b3dee2..af910ff 100644 --- a/api/handlers/indices.go +++ b/cloud/api/handlers/indices.go @@ -3,7 +3,7 @@ package handlers import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // FTSequenceIndices is a handler function that returns a fiber context handler function for sequencing the full-text storage indices. diff --git a/api/handlers/info.go b/cloud/api/handlers/info.go similarity index 95% rename from api/handlers/info.go rename to cloud/api/handlers/info.go index ff3e28a..36213dc 100644 --- a/api/handlers/info.go +++ b/cloud/api/handlers/info.go @@ -3,7 +3,7 @@ package handlers import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // Info is a function that returns information about the cache. diff --git a/api/handlers/init.go b/cloud/api/handlers/init.go similarity index 98% rename from api/handlers/init.go rename to cloud/api/handlers/init.go index a5f4626..409fcd7 100644 --- a/api/handlers/init.go +++ b/cloud/api/handlers/init.go @@ -3,7 +3,7 @@ package handlers import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // FTInit is a handler function that returns a fiber context handler function for initializing the full-text search cache. diff --git a/api/handlers/keys.go b/cloud/api/handlers/keys.go similarity index 93% rename from api/handlers/keys.go rename to cloud/api/handlers/keys.go index a6728ff..edc5374 100644 --- a/api/handlers/keys.go +++ b/cloud/api/handlers/keys.go @@ -5,7 +5,7 @@ import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // Keys is a handler function that returns a fiber context handler function for getting all the keys from the cache. diff --git a/api/handlers/length.go b/cloud/api/handlers/length.go similarity index 92% rename from api/handlers/length.go rename to cloud/api/handlers/length.go index 4a030e6..16c72ce 100644 --- a/api/handlers/length.go +++ b/cloud/api/handlers/length.go @@ -3,7 +3,7 @@ package handlers import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // Length is a handler function that returns a fiber context handler function for getting the length of the cache. diff --git a/api/handlers/search.go b/cloud/api/handlers/search.go similarity index 99% rename from api/handlers/search.go rename to cloud/api/handlers/search.go index ebacd14..356a1b3 100644 --- a/api/handlers/search.go +++ b/cloud/api/handlers/search.go @@ -5,7 +5,7 @@ import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // Search is a handler function that returns a fiber context handler function for searching the cache. diff --git a/api/handlers/set.go b/cloud/api/handlers/set.go similarity index 95% rename from api/handlers/set.go rename to cloud/api/handlers/set.go index db63e48..c29a56e 100644 --- a/api/handlers/set.go +++ b/cloud/api/handlers/set.go @@ -3,7 +3,7 @@ package handlers import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // Set is a handler function that returns a fiber context handler function for setting a value in the cache. diff --git a/api/handlers/values.go b/cloud/api/handlers/values.go similarity index 93% rename from api/handlers/values.go rename to cloud/api/handlers/values.go index 6621bbb..6db70a3 100644 --- a/api/handlers/values.go +++ b/cloud/api/handlers/values.go @@ -5,7 +5,7 @@ import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/api/utils" + Utils "github.com/realTristan/Hermes/cloud/api/utils" ) // Values is a handler function that returns a fiber context handler function for getting all values from the cache. diff --git a/api/routes.go b/cloud/api/routes.go similarity index 97% rename from api/routes.go rename to cloud/api/routes.go index 169742a..eb74684 100644 --- a/api/routes.go +++ b/cloud/api/routes.go @@ -3,7 +3,7 @@ package api import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - "github.com/realTristan/Hermes/api/handlers" + "github.com/realTristan/Hermes/cloud/api/handlers" ) // SetRoutes is a function that sets the routes for the Hermes Cache API. diff --git a/api/utils/decode.go b/cloud/api/utils/decode.go similarity index 100% rename from api/utils/decode.go rename to cloud/api/utils/decode.go diff --git a/api/utils/http.go b/cloud/api/utils/http.go similarity index 100% rename from api/utils/http.go rename to cloud/api/utils/http.go diff --git a/api/utils/params.go b/cloud/api/utils/params.go similarity index 100% rename from api/utils/params.go rename to cloud/api/utils/params.go diff --git a/cloud/app/server/main.go b/cloud/app/server/main.go index 537a016..da5c2da 100644 --- a/cloud/app/server/main.go +++ b/cloud/app/server/main.go @@ -8,7 +8,7 @@ import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - socket "github.com/realTristan/Hermes/socket" + Socket "github.com/realTristan/Hermes/cloud/socket" ) // Main function @@ -32,7 +32,7 @@ func main() { Prefork: false, ServerHeader: "Hermes", }) - socket.SetRouter(app, cache) + Socket.SetRouter(app, cache) // Listen on the port log.Fatal(app.Listen(args.Port().(string))) diff --git a/database/.gitkeep b/cloud/database/.gitkeep similarity index 100% rename from database/.gitkeep rename to cloud/database/.gitkeep diff --git a/cloud/socket/errors.go b/cloud/socket/errors.go new file mode 100644 index 0000000..a5f8d96 --- /dev/null +++ b/cloud/socket/errors.go @@ -0,0 +1,12 @@ +package ws + +import ( + "strings" +) + +// Check whether the error is a close error by converting +// the error to a string and checking if it contains the +// word "close". +func IsCloseError(err error) bool { + return strings.Contains(err.Error(), "close") +} diff --git a/socket/funcs.go b/cloud/socket/funcs.go similarity index 91% rename from socket/funcs.go rename to cloud/socket/funcs.go index 3ba1269..f9dcb27 100644 --- a/socket/funcs.go +++ b/cloud/socket/funcs.go @@ -2,8 +2,8 @@ package ws import ( Hermes "github.com/realTristan/Hermes" - "github.com/realTristan/Hermes/socket/handlers" - Utils "github.com/realTristan/Hermes/socket/utils" + "github.com/realTristan/Hermes/cloud/socket/handlers" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // Map of functions that can be called from the client diff --git a/socket/handlers/clean.go b/cloud/socket/handlers/clean.go similarity index 94% rename from socket/handlers/clean.go rename to cloud/socket/handlers/clean.go index e2f5848..8d80128 100644 --- a/socket/handlers/clean.go +++ b/cloud/socket/handlers/clean.go @@ -2,7 +2,7 @@ package handlers import ( Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // Clean is a handler function that returns a fiber context handler function for cleaning the cache. diff --git a/socket/handlers/delete.go b/cloud/socket/handlers/delete.go similarity index 93% rename from socket/handlers/delete.go rename to cloud/socket/handlers/delete.go index 94c783e..5b07a04 100644 --- a/socket/handlers/delete.go +++ b/cloud/socket/handlers/delete.go @@ -2,7 +2,7 @@ package handlers import ( Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // Delete is a handler function that returns a fiber context handler function for deleting a key from the cache. diff --git a/socket/handlers/exists.go b/cloud/socket/handlers/exists.go similarity index 93% rename from socket/handlers/exists.go rename to cloud/socket/handlers/exists.go index e712eec..1fa0b86 100644 --- a/socket/handlers/exists.go +++ b/cloud/socket/handlers/exists.go @@ -2,7 +2,7 @@ package handlers import ( Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // Exists is a handler function that returns a fiber context handler function for checking if a key exists in the cache. diff --git a/socket/handlers/fulltext.go b/cloud/socket/handlers/fulltext.go similarity index 98% rename from socket/handlers/fulltext.go rename to cloud/socket/handlers/fulltext.go index 06f9634..d846d19 100644 --- a/socket/handlers/fulltext.go +++ b/cloud/socket/handlers/fulltext.go @@ -4,7 +4,7 @@ import ( "encoding/json" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // FTIsInitialized is a handler function that returns a fiber context handler function for checking if the full-text storage is initialized. diff --git a/socket/handlers/get.go b/cloud/socket/handlers/get.go similarity index 95% rename from socket/handlers/get.go rename to cloud/socket/handlers/get.go index 7c9df75..82d98e2 100644 --- a/socket/handlers/get.go +++ b/cloud/socket/handlers/get.go @@ -4,7 +4,7 @@ import ( "encoding/json" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // Get is a handler function that returns a fiber context handler function for retrieving a key from the cache. diff --git a/socket/handlers/indices.go b/cloud/socket/handlers/indices.go similarity index 91% rename from socket/handlers/indices.go rename to cloud/socket/handlers/indices.go index 5990467..13de68a 100644 --- a/socket/handlers/indices.go +++ b/cloud/socket/handlers/indices.go @@ -2,7 +2,7 @@ package handlers import ( Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // FTSequenceIndices is a handler function that returns a fiber context handler function for sequencing the full-text storage indices. diff --git a/socket/handlers/info.go b/cloud/socket/handlers/info.go similarity index 95% rename from socket/handlers/info.go rename to cloud/socket/handlers/info.go index 08d8cf9..f200076 100644 --- a/socket/handlers/info.go +++ b/cloud/socket/handlers/info.go @@ -2,7 +2,7 @@ package handlers import ( Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // Info is a function that returns information about the cache. diff --git a/socket/handlers/init.go b/cloud/socket/handlers/init.go similarity index 97% rename from socket/handlers/init.go rename to cloud/socket/handlers/init.go index ee6e9c4..6221706 100644 --- a/socket/handlers/init.go +++ b/cloud/socket/handlers/init.go @@ -2,7 +2,7 @@ package handlers import ( Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // FTInit is a handler function that returns a fiber context handler function for initializing the full-text search cache. diff --git a/socket/handlers/keys.go b/cloud/socket/handlers/keys.go similarity index 91% rename from socket/handlers/keys.go rename to cloud/socket/handlers/keys.go index 7a7955d..e181a6c 100644 --- a/socket/handlers/keys.go +++ b/cloud/socket/handlers/keys.go @@ -4,7 +4,7 @@ import ( "encoding/json" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // Keys is a handler function that returns a fiber context handler function for retrieving all keys from the cache. diff --git a/socket/handlers/length.go b/cloud/socket/handlers/length.go similarity index 89% rename from socket/handlers/length.go rename to cloud/socket/handlers/length.go index d5d77a1..40eb160 100644 --- a/socket/handlers/length.go +++ b/cloud/socket/handlers/length.go @@ -2,7 +2,7 @@ package handlers import ( Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // Length is a handler function that returns a fiber context handler function for retrieving the length of the cache. diff --git a/socket/handlers/search.go b/cloud/socket/handlers/search.go similarity index 98% rename from socket/handlers/search.go rename to cloud/socket/handlers/search.go index b5371c8..a56e507 100644 --- a/socket/handlers/search.go +++ b/cloud/socket/handlers/search.go @@ -4,7 +4,7 @@ import ( "encoding/json" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // Search is a handler function that returns a fiber context handler function for searching the cache for a query. diff --git a/socket/handlers/set.go b/cloud/socket/handlers/set.go similarity index 94% rename from socket/handlers/set.go rename to cloud/socket/handlers/set.go index 4f7ea19..aa77b3b 100644 --- a/socket/handlers/set.go +++ b/cloud/socket/handlers/set.go @@ -2,7 +2,7 @@ package handlers import ( Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // Set is a handler function that returns a fiber context handler function for setting a value in the cache. diff --git a/socket/handlers/values.go b/cloud/socket/handlers/values.go similarity index 91% rename from socket/handlers/values.go rename to cloud/socket/handlers/values.go index 5778b96..67a6634 100644 --- a/socket/handlers/values.go +++ b/cloud/socket/handlers/values.go @@ -4,7 +4,7 @@ import ( "encoding/json" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // Values is a handler function that returns a fiber context handler function for retrieving all values from the cache. diff --git a/socket/router.go b/cloud/socket/router.go similarity index 96% rename from socket/router.go rename to cloud/socket/router.go index 83f3e4c..cc813e9 100644 --- a/socket/router.go +++ b/cloud/socket/router.go @@ -7,7 +7,7 @@ import ( "github.com/gofiber/fiber/v2" "github.com/gofiber/websocket/v2" Hermes "github.com/realTristan/Hermes" - Utils "github.com/realTristan/Hermes/socket/utils" + Utils "github.com/realTristan/Hermes/cloud/socket/utils" ) // Set the router for the socket diff --git a/socket/socket.go b/cloud/socket/socket.go similarity index 100% rename from socket/socket.go rename to cloud/socket/socket.go diff --git a/socket/utils/decode.go b/cloud/socket/utils/decode.go similarity index 100% rename from socket/utils/decode.go rename to cloud/socket/utils/decode.go diff --git a/socket/utils/errors.go b/cloud/socket/utils/errors.go similarity index 100% rename from socket/utils/errors.go rename to cloud/socket/utils/errors.go diff --git a/socket/utils/http.go b/cloud/socket/utils/http.go similarity index 100% rename from socket/utils/http.go rename to cloud/socket/utils/http.go diff --git a/socket/utils/params.go b/cloud/socket/utils/params.go similarity index 100% rename from socket/utils/params.go rename to cloud/socket/utils/params.go diff --git a/cloud/wrappers/dart/main.dart b/cloud/wrappers/dart/main.dart deleted file mode 100644 index e69de29..0000000 diff --git a/cloud/wrappers/go/main.go b/cloud/wrappers/go/main.go index fcf7f3f..2189f88 100644 --- a/cloud/wrappers/go/main.go +++ b/cloud/wrappers/go/main.go @@ -1,4 +1,4 @@ -package main +package hermescloud func Get() { // send http request diff --git a/socket/errors.go b/socket/errors.go deleted file mode 100644 index ba3da3a..0000000 --- a/socket/errors.go +++ /dev/null @@ -1,37 +0,0 @@ -package ws - -import ( - "strings" - - "github.com/gofiber/websocket/v2" -) - -// Check whether the error is a close error by converting -// the error to a string and checking if it contains the -// word "close". -func IsCloseError(err error) bool { - return strings.Contains(err.Error(), "close") -} - -// Check whether the error is a close error using websocket -// error codes and IsCloseError function. -func _IsCloseError(err error) bool { - return websocket.IsCloseError( - err, - websocket.CloseNormalClosure, - websocket.CloseGoingAway, - websocket.CloseAbnormalClosure, - websocket.CloseNoStatusReceived, - websocket.CloseInvalidFramePayloadData, - websocket.ClosePolicyViolation, - websocket.CloseMessageTooBig, - websocket.CloseMandatoryExtension, - websocket.CloseInternalServerErr, - websocket.CloseServiceRestart, - websocket.CloseTryAgainLater, - websocket.CloseTLSHandshake, - websocket.CloseMessage, - websocket.CloseProtocolError, - websocket.CloseUnsupportedData, - ) -} diff --git a/api/testing/api.go b/testing/api/router.go similarity index 100% rename from api/testing/api.go rename to testing/api/router.go diff --git a/api/testing/test_withjson.py b/testing/api/test_withjson.py similarity index 100% rename from api/testing/test_withjson.py rename to testing/api/test_withjson.py diff --git a/testing/data/array_to_ft.py b/testing/data/array_to_ft.py deleted file mode 100644 index 55ecad6..0000000 --- a/testing/data/array_to_ft.py +++ /dev/null @@ -1,23 +0,0 @@ -import json - -data: list = json.load(open("data_array.json")) -for i, item in enumerate(data): - data[i]["description"] = { - "$hermes.full_text": True, - "$value": item["description"] - } - if "pre_requisites" in item: - data[i]["pre_requisites"] = { - "$hermes.full_text": True, - "$value": item["pre_requisites"] - } - data[i]["title"] = { - "$hermes.full_text": True, - "$value": item["title"] - } - data[i]["name"] = { - "$hermes.full_text": True, - "$value": item["name"] - } - -json.dump(data, open("data_array.json", "w"), indent=4) \ No newline at end of file diff --git a/testing/data/hash_to_ft.py b/testing/data/hash_to_ft.py deleted file mode 100644 index cfb893d..0000000 --- a/testing/data/hash_to_ft.py +++ /dev/null @@ -1,23 +0,0 @@ -import json - -data: dict = json.load(open("data_hash.json")) -for k, v in data.items(): - data[k]["description"] = { - "$hermes.full_text": True, - "$value": v["description"] - } - if "pre_requisites" in v: - data[k]["pre_requisites"] = { - "$hermes.full_text": True, - "$value": v["pre_requisites"] - } - data[k]["title"] = { - "$hermes.full_text": True, - "$value": v["title"] - } - data[k]["name"] = { - "$hermes.full_text": True, - "$value": v["name"] - } - -json.dump(data, open("data_hash.json", "w"), indent=4) \ No newline at end of file diff --git a/testing/data/to_hash.py b/testing/data/to_hash.py deleted file mode 100644 index ed0799c..0000000 --- a/testing/data/to_hash.py +++ /dev/null @@ -1,13 +0,0 @@ -import json, hashlib, time - -# // Read the _data.json file -data = {} - -# // Iterate over the data -for i, v in enumerate(json.load(open("../data/data.json", "r"))): - while hash in data: - hash: str = hashlib.sha1(str(time.time_ns()).encode("utf-8")).hexdigest() - data[hash] = v - -# // Write the data to the data.json file with spacing -json.dump(data, open("../data/data.json", "w"), indent=4) \ No newline at end of file diff --git a/socket/testing/ws.go b/testing/socket/router.go similarity index 84% rename from socket/testing/ws.go rename to testing/socket/router.go index 632a828..837b139 100644 --- a/socket/testing/ws.go +++ b/testing/socket/router.go @@ -3,7 +3,7 @@ package main import ( "github.com/gofiber/fiber/v2" Hermes "github.com/realTristan/Hermes" - Socket "github.com/realTristan/Hermes/socket" + Socket "github.com/realTristan/Hermes/cloud/socket" ) func main() { diff --git a/cloud/webpage/.editorconfig b/website/.editorconfig similarity index 100% rename from cloud/webpage/.editorconfig rename to website/.editorconfig diff --git a/cloud/webpage/.gitignore b/website/.gitignore similarity index 100% rename from cloud/webpage/.gitignore rename to website/.gitignore diff --git a/cloud/webpage/.vscode/extensions.json b/website/.vscode/extensions.json similarity index 100% rename from cloud/webpage/.vscode/extensions.json rename to website/.vscode/extensions.json diff --git a/cloud/webpage/.vscode/launch.json b/website/.vscode/launch.json similarity index 100% rename from cloud/webpage/.vscode/launch.json rename to website/.vscode/launch.json diff --git a/cloud/webpage/.vscode/tasks.json b/website/.vscode/tasks.json similarity index 100% rename from cloud/webpage/.vscode/tasks.json rename to website/.vscode/tasks.json diff --git a/cloud/webpage/README.md b/website/README.md similarity index 100% rename from cloud/webpage/README.md rename to website/README.md diff --git a/cloud/webpage/angular.json b/website/angular.json similarity index 100% rename from cloud/webpage/angular.json rename to website/angular.json diff --git a/cloud/webpage/package-lock.json b/website/package-lock.json similarity index 100% rename from cloud/webpage/package-lock.json rename to website/package-lock.json diff --git a/cloud/webpage/package.json b/website/package.json similarity index 100% rename from cloud/webpage/package.json rename to website/package.json diff --git a/cloud/webpage/src/app/app-routing.module.ts b/website/src/app/app-routing.module.ts similarity index 100% rename from cloud/webpage/src/app/app-routing.module.ts rename to website/src/app/app-routing.module.ts diff --git a/cloud/webpage/src/app/app.component.css b/website/src/app/app.component.css similarity index 100% rename from cloud/webpage/src/app/app.component.css rename to website/src/app/app.component.css diff --git a/cloud/webpage/src/app/app.component.html b/website/src/app/app.component.html similarity index 95% rename from cloud/webpage/src/app/app.component.html rename to website/src/app/app.component.html index 9b92820..de16c9d 100644 --- a/cloud/webpage/src/app/app.component.html +++ b/website/src/app/app.component.html @@ -11,7 +11,7 @@

The speed you need. Execute lightning fast full-text searches with just a few lines of code. Easily access your data with caching. Both Socket and API implementations are already - provided. Start now with Python, Go, Typescript, or Rust. + provided. Start now with Go.

@@ -43,8 +43,7 @@

Connect with confidence. Install the Hermes Cloud CLI and immediately begin developing in other languages. Hermes Cloud takes advantage of - sockets to deliver powerful performance. Start now with Python, Go, Typescript, or - Rust.

+ sockets to deliver powerful performance. Start now with Python.

diff --git a/cloud/webpage/src/app/app.component.spec.ts b/website/src/app/app.component.spec.ts similarity index 100% rename from cloud/webpage/src/app/app.component.spec.ts rename to website/src/app/app.component.spec.ts diff --git a/cloud/webpage/src/app/app.component.ts b/website/src/app/app.component.ts similarity index 100% rename from cloud/webpage/src/app/app.component.ts rename to website/src/app/app.component.ts diff --git a/cloud/webpage/src/app/app.module.ts b/website/src/app/app.module.ts similarity index 100% rename from cloud/webpage/src/app/app.module.ts rename to website/src/app/app.module.ts diff --git a/cloud/webpage/src/app/code-example/code-example.component.css b/website/src/app/code-example/code-example.component.css similarity index 100% rename from cloud/webpage/src/app/code-example/code-example.component.css rename to website/src/app/code-example/code-example.component.css diff --git a/cloud/webpage/src/app/code-example/code-example.component.html b/website/src/app/code-example/code-example.component.html similarity index 100% rename from cloud/webpage/src/app/code-example/code-example.component.html rename to website/src/app/code-example/code-example.component.html diff --git a/cloud/webpage/src/app/code-example/code-example.component.spec.ts b/website/src/app/code-example/code-example.component.spec.ts similarity index 100% rename from cloud/webpage/src/app/code-example/code-example.component.spec.ts rename to website/src/app/code-example/code-example.component.spec.ts diff --git a/cloud/webpage/src/app/code-example/code-example.component.ts b/website/src/app/code-example/code-example.component.ts similarity index 100% rename from cloud/webpage/src/app/code-example/code-example.component.ts rename to website/src/app/code-example/code-example.component.ts diff --git a/cloud/webpage/src/app/laptop/laptop.component.html b/website/src/app/laptop/laptop.component.html similarity index 100% rename from cloud/webpage/src/app/laptop/laptop.component.html rename to website/src/app/laptop/laptop.component.html diff --git a/cloud/webpage/src/app/laptop/laptop.component.scss b/website/src/app/laptop/laptop.component.scss similarity index 100% rename from cloud/webpage/src/app/laptop/laptop.component.scss rename to website/src/app/laptop/laptop.component.scss diff --git a/cloud/webpage/src/app/laptop/laptop.component.spec.ts b/website/src/app/laptop/laptop.component.spec.ts similarity index 100% rename from cloud/webpage/src/app/laptop/laptop.component.spec.ts rename to website/src/app/laptop/laptop.component.spec.ts diff --git a/cloud/webpage/src/app/laptop/laptop.component.ts b/website/src/app/laptop/laptop.component.ts similarity index 100% rename from cloud/webpage/src/app/laptop/laptop.component.ts rename to website/src/app/laptop/laptop.component.ts diff --git a/cloud/webpage/src/app/navbar-button/navbar-button.component.css b/website/src/app/navbar-button/navbar-button.component.css similarity index 100% rename from cloud/webpage/src/app/navbar-button/navbar-button.component.css rename to website/src/app/navbar-button/navbar-button.component.css diff --git a/cloud/webpage/src/app/navbar-button/navbar-button.component.html b/website/src/app/navbar-button/navbar-button.component.html similarity index 100% rename from cloud/webpage/src/app/navbar-button/navbar-button.component.html rename to website/src/app/navbar-button/navbar-button.component.html diff --git a/cloud/webpage/src/app/navbar-button/navbar-button.component.spec.ts b/website/src/app/navbar-button/navbar-button.component.spec.ts similarity index 100% rename from cloud/webpage/src/app/navbar-button/navbar-button.component.spec.ts rename to website/src/app/navbar-button/navbar-button.component.spec.ts diff --git a/cloud/webpage/src/app/navbar-button/navbar-button.component.ts b/website/src/app/navbar-button/navbar-button.component.ts similarity index 100% rename from cloud/webpage/src/app/navbar-button/navbar-button.component.ts rename to website/src/app/navbar-button/navbar-button.component.ts diff --git a/cloud/webpage/src/app/navbar/navbar.component.css b/website/src/app/navbar/navbar.component.css similarity index 100% rename from cloud/webpage/src/app/navbar/navbar.component.css rename to website/src/app/navbar/navbar.component.css diff --git a/cloud/webpage/src/app/navbar/navbar.component.html b/website/src/app/navbar/navbar.component.html similarity index 100% rename from cloud/webpage/src/app/navbar/navbar.component.html rename to website/src/app/navbar/navbar.component.html diff --git a/cloud/webpage/src/app/navbar/navbar.component.spec.ts b/website/src/app/navbar/navbar.component.spec.ts similarity index 100% rename from cloud/webpage/src/app/navbar/navbar.component.spec.ts rename to website/src/app/navbar/navbar.component.spec.ts diff --git a/cloud/webpage/src/app/navbar/navbar.component.ts b/website/src/app/navbar/navbar.component.ts similarity index 100% rename from cloud/webpage/src/app/navbar/navbar.component.ts rename to website/src/app/navbar/navbar.component.ts diff --git a/cloud/webpage/src/app/terminal/terminal.component.css b/website/src/app/terminal/terminal.component.css similarity index 100% rename from cloud/webpage/src/app/terminal/terminal.component.css rename to website/src/app/terminal/terminal.component.css diff --git a/cloud/webpage/src/app/terminal/terminal.component.html b/website/src/app/terminal/terminal.component.html similarity index 100% rename from cloud/webpage/src/app/terminal/terminal.component.html rename to website/src/app/terminal/terminal.component.html diff --git a/cloud/webpage/src/app/terminal/terminal.component.spec.ts b/website/src/app/terminal/terminal.component.spec.ts similarity index 100% rename from cloud/webpage/src/app/terminal/terminal.component.spec.ts rename to website/src/app/terminal/terminal.component.spec.ts diff --git a/cloud/webpage/src/app/terminal/terminal.component.ts b/website/src/app/terminal/terminal.component.ts similarity index 100% rename from cloud/webpage/src/app/terminal/terminal.component.ts rename to website/src/app/terminal/terminal.component.ts diff --git a/cloud/webpage/src/assets/.gitkeep b/website/src/assets/.gitkeep similarity index 100% rename from cloud/webpage/src/assets/.gitkeep rename to website/src/assets/.gitkeep diff --git a/cloud/webpage/src/assets/images/github.png b/website/src/assets/images/github.png similarity index 100% rename from cloud/webpage/src/assets/images/github.png rename to website/src/assets/images/github.png diff --git a/cloud/webpage/src/assets/images/logo.png b/website/src/assets/images/logo.png similarity index 100% rename from cloud/webpage/src/assets/images/logo.png rename to website/src/assets/images/logo.png diff --git a/cloud/webpage/src/favicon.ico b/website/src/favicon.ico similarity index 100% rename from cloud/webpage/src/favicon.ico rename to website/src/favicon.ico diff --git a/cloud/webpage/src/index.html b/website/src/index.html similarity index 100% rename from cloud/webpage/src/index.html rename to website/src/index.html diff --git a/cloud/webpage/src/main.ts b/website/src/main.ts similarity index 100% rename from cloud/webpage/src/main.ts rename to website/src/main.ts diff --git a/cloud/webpage/src/styles.css b/website/src/styles.css similarity index 100% rename from cloud/webpage/src/styles.css rename to website/src/styles.css diff --git a/cloud/webpage/tailwind.config.js b/website/tailwind.config.js similarity index 100% rename from cloud/webpage/tailwind.config.js rename to website/tailwind.config.js diff --git a/cloud/webpage/tsconfig.app.json b/website/tsconfig.app.json similarity index 100% rename from cloud/webpage/tsconfig.app.json rename to website/tsconfig.app.json diff --git a/cloud/webpage/tsconfig.json b/website/tsconfig.json similarity index 100% rename from cloud/webpage/tsconfig.json rename to website/tsconfig.json diff --git a/cloud/webpage/tsconfig.spec.json b/website/tsconfig.spec.json similarity index 100% rename from cloud/webpage/tsconfig.spec.json rename to website/tsconfig.spec.json