Skip to content

Commit

Permalink
cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
realTristan committed Jun 4, 2023
1 parent 98ed684 commit 7ccfd80
Show file tree
Hide file tree
Showing 96 changed files with 71 additions and 156 deletions.
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/clean.go → cloud/api/handlers/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/delete.go → cloud/api/handlers/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/exists.go → cloud/api/handlers/exists.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/get.go → cloud/api/handlers/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/indices.go → cloud/api/handlers/indices.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/info.go → cloud/api/handlers/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/init.go → cloud/api/handlers/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/keys.go → cloud/api/handlers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/length.go → cloud/api/handlers/length.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/search.go → cloud/api/handlers/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/set.go → cloud/api/handlers/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/handlers/values.go → cloud/api/handlers/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/routes.go → cloud/api/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions cloud/app/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)))
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions cloud/socket/errors.go
Original file line number Diff line number Diff line change
@@ -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")
}
4 changes: 2 additions & 2 deletions socket/funcs.go → cloud/socket/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 7ccfd80

Please sign in to comment.