Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: rework mutagen controller, add polling#65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionApp/App.xaml.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -120,7 +120,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs args)
// Initialize file sync.
var syncSessionCts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
var syncSessionController = _services.GetRequiredService<ISyncSessionController>();
_ = syncSessionController.Initialize(syncSessionCts.Token).ContinueWith(t =>
_ = syncSessionController.RefreshState(syncSessionCts.Token).ContinueWith(t =>
{
// TODO: log
#if DEBUG
Expand Down
9 changes: 4 additions & 5 deletionsApp/Models/RpcModel.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using Coder.Desktop.Vpn.Proto;

namespace Coder.Desktop.App.Models;
Expand All@@ -26,18 +25,18 @@ public class RpcModel

public VpnLifecycle VpnLifecycle { get; set; } = VpnLifecycle.Unknown;

publicList<Workspace> Workspaces { get; set; } = [];
publicIReadOnlyList<Workspace> Workspaces { get; set; } = [];

publicList<Agent> Agents { get; set; } = [];
publicIReadOnlyList<Agent> Agents { get; set; } = [];

public RpcModel Clone()
{
return new RpcModel
{
RpcLifecycle = RpcLifecycle,
VpnLifecycle = VpnLifecycle,
Workspaces = Workspaces.ToList(),
Agents = Agents.ToList(),
Workspaces = Workspaces,
Agents = Agents,
};
}
}
43 changes: 43 additions & 0 deletionsApp/Models/SyncSessionControllerStateModel.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
using System.Collections.Generic;

namespace Coder.Desktop.App.Models;

public enum SyncSessionControllerLifecycle
{
// Uninitialized means that the daemon has not been started yet. This can
// be resolved by calling RefreshState (or any other RPC method
// successfully).
Uninitialized,

// Stopped means that the daemon is not running. This could be because:
// - It was never started (pre-Initialize)
// - It was stopped due to no sync sessions (post-Initialize, post-operation)
// - The last start attempt failed (DaemonError will be set)
// - The last daemon process crashed (DaemonError will be set)
Stopped,

// Running is the normal state where the daemon is running and managing
// sync sessions. This is only set after a successful start (including
// being able to connect to the daemon).
Running,
}

public class SyncSessionControllerStateModel
{
public SyncSessionControllerLifecycle Lifecycle { get; init; } = SyncSessionControllerLifecycle.Stopped;

/// <summary>
/// May be set when Lifecycle is Stopped to signify that the daemon failed
/// to start or unexpectedly crashed.
/// </summary>
public string? DaemonError { get; init; }

public required string DaemonLogFilePath { get; init; }

/// <summary>
/// This contains the last known state of all sync sessions. Sync sessions
/// are periodically refreshed if the daemon is running. This list is
/// sorted by creation time.
/// </summary>
public IReadOnlyList<SyncSessionModel> SyncSessions { get; init; } = [];
}
2 changes: 2 additions & 0 deletionsApp/Models/SyncSessionModel.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,6 +51,7 @@ public string Description(string linePrefix = "")
public class SyncSessionModel
{
public readonly string Identifier;
public readonly DateTime CreatedAt;

public readonly string AlphaName;
public readonly string AlphaPath;
Expand DownExpand Up@@ -99,6 +100,7 @@ public string SizeDetails
public SyncSessionModel(State state)
{
Identifier = state.Session.Identifier;
CreatedAt = state.Session.CreationTime.ToDateTime();

(AlphaName, AlphaPath) = NameAndPathFromUrl(state.Session.Alpha);
(BetaName, BetaPath) = NameAndPathFromUrl(state.Session.Beta);
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp