mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-25 04:46:04 +08:00
Apply review comments
This commit is contained in:
parent
c0184bd5c2
commit
313d25779b
1 changed files with 2 additions and 13 deletions
|
|
@ -42,7 +42,7 @@ defmodule Livebook.FileSystem.Mounter do
|
|||
end
|
||||
|
||||
def handle_info({:file_system_updated, file_system}, state) do
|
||||
{:noreply, update_file_system(state, file_system)}
|
||||
{:noreply, mount_file_system(state, file_system)}
|
||||
end
|
||||
|
||||
def handle_info({:file_system_deleted, file_system}, state) do
|
||||
|
|
@ -79,7 +79,7 @@ defmodule Livebook.FileSystem.Mounter do
|
|||
defp remount_file_systems(state) do
|
||||
Enum.reduce(state.hubs, state, fn {hub_id, hub_data}, acc ->
|
||||
case Hubs.fetch_hub(hub_id) do
|
||||
{:ok, _} -> Enum.reduce(hub_data.file_systems, acc, &update_file_system(&2, &1))
|
||||
{:ok, _} -> Enum.reduce(hub_data.file_systems, acc, &mount_file_system(&2, &1))
|
||||
:error -> unmount_file_systems(acc, hub_id)
|
||||
end
|
||||
end)
|
||||
|
|
@ -106,17 +106,6 @@ defmodule Livebook.FileSystem.Mounter do
|
|||
end
|
||||
end
|
||||
|
||||
defp update_file_system(state, file_system) do
|
||||
case FileSystem.mount(file_system) do
|
||||
:ok ->
|
||||
broadcast({:file_system_mounted, file_system})
|
||||
put_hub_file_system(state, file_system)
|
||||
|
||||
{:error, _reason} ->
|
||||
state
|
||||
end
|
||||
end
|
||||
|
||||
defp unmount_file_system(state, file_system) do
|
||||
case FileSystem.unmount(file_system) do
|
||||
:ok ->
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue