Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

Commit

Permalink
Better organization of Websocket modules
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomassaro committed Nov 10, 2017
1 parent 197adf2 commit 2e76ba4
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 32 deletions.
6 changes: 3 additions & 3 deletions lib/server/websocket/channel/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ channel Helix.Server.Websocket.Channel.Server do
- storage_id: Specify which storage the file should be downloaded to. Defaults
to the main storage.
Returns: RenderedProcess.t
Returns: :ok
Errors:
- "file_not_found": Requested file to be downloaded was not found
Expand Down Expand Up @@ -161,7 +161,7 @@ channel Helix.Server.Websocket.Channel.Server do
- storage_id: Specify which storage the file should be downloaded to. Defaults
to the main storage.
Returns: RenderedProcess.t
Returns: :ok
Errors:
- "pftp_must_be_local": PFTP operations must happen at the local socket.
Expand Down Expand Up @@ -205,7 +205,7 @@ channel Helix.Server.Websocket.Channel.Server do
Note that all bruteforce attacks must originate from a server owned by the
entity starting the attack.
Returns: RenderedProcess.t
Returns: :ok
Errors:
- "cracker_not_found" - Player attempting the attack does not have a valid
Expand Down
2 changes: 2 additions & 0 deletions lib/software/public/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ defmodule Helix.Software.Public.Index do
end)
end

@spec render_file(File.t) ::
rendered_index_file
def render_file(file = %File{}) do
%{
file_id: to_string(file.file_id),
Expand Down
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions lib/websocket/request/relay.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
defmodule Helix.Websocket.Request.Relay do
@moduledoc """
`RequestRelay` is a struct intended to be relayed all the way from the Request
to the Public to the ActionFlow, so it can be used by `Helix.Event` to
identify the `request_id` and create a meaningful stacktrace.
"""

defstruct [:request_id]

@type t :: t_of_type(binary)

@type t_of_type(type) ::
%__MODULE__{
request_id: type
}

@spec new(map) ::
t
| t_of_type(nil)
def new(%{"request_id" => request_id}) when is_binary(request_id) do
%__MODULE__{
request_id: request_id
}
end
def new(_),
do: %__MODULE__{}
end
29 changes: 0 additions & 29 deletions lib/websocket/request.ex → lib/websocket/request/request.ex
Original file line number Diff line number Diff line change
Expand Up @@ -115,33 +115,4 @@ defmodule Helix.Websocket.Request do

end
end

end

defmodule Helix.Websocket.Request.Relay do
@moduledoc """
`RequestRelay` is a struct intended to be relayed all the way from the Request
to the Public to the ActionFlow, so it can be used by `Helix.Event` to
identify the `request_id` and create a meaningful stacktrace.
"""

defstruct [:request_id]

@type t :: t_of_type(binary)

@type t_of_type(type) ::
%__MODULE__{
request_id: type
}

@spec new(map) ::
t
| t_of_type(nil)
def new(%{"request_id" => request_id}) when is_binary(request_id) do
%__MODULE__{
request_id: request_id
}
end
def new(_),
do: %__MODULE__{}
end
File renamed without changes.

0 comments on commit 2e76ba4

Please sign in to comment.