-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(server): visualization with lcjs (#45)
* refactor: 🚚 server folder structure * feat: visualization with lcjs * build(server): add eslint and prettier * build(server): add lint and format to npm scripts * fix(server): complex array formatter causing gen2 gc * build(server): exclude configs from publish
- Loading branch information
Showing
56 changed files
with
4,490 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* eslint-env node */ | ||
module.exports = { | ||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["@typescript-eslint"], | ||
root: true, | ||
ignorePatterns: ["**/wwwroot/**/*", "Pages/**/*.js"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## Ignore bundled JS files | ||
**/*.razor.js | ||
**/*.razor.js.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
[Ww][Ii][Nn]32/ | ||
[Aa][Rr][Mm]/ | ||
[Aa][Rr][Mm]64/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
[Oo]ut/ | ||
[Ll]og/ | ||
[Ll]ogs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Router AppAssembly="@typeof(App).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | ||
<FocusOnNavigate RouteData="@routeData" Selector="h1" /> | ||
</Found> | ||
<NotFound> | ||
<PageTitle>Not found</PageTitle> | ||
<LayoutView Layout="@typeof(MainLayout)"> | ||
<p role="alert">Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
namespace Qynit.PulseGen.Server; | ||
|
||
public static class ArcUnsafe | ||
{ | ||
public static ArcUnsafe<T> Wrap<T>(T disposable) where T : IDisposable | ||
{ | ||
return new ArcUnsafe<T>(disposable); | ||
} | ||
} | ||
|
||
public readonly struct ArcUnsafe<T> : IDisposable where T : IDisposable | ||
{ | ||
private readonly RefCountBox _refCountBox; | ||
public T Target { get; } | ||
|
||
public ArcUnsafe(T disposable) | ||
{ | ||
_refCountBox = new RefCountBox(); | ||
Target = disposable; | ||
} | ||
|
||
public ArcUnsafe<T> Clone() | ||
{ | ||
_refCountBox.Acquire(); | ||
return this; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
var refCount = _refCountBox.Release(); | ||
if (refCount == 0) | ||
{ | ||
Target.Dispose(); | ||
} | ||
} | ||
|
||
private class RefCountBox | ||
{ | ||
private int _referenceCount; | ||
public int Acquire() | ||
{ | ||
return Interlocked.Increment(ref _referenceCount); | ||
} | ||
|
||
public int Release() | ||
{ | ||
return Interlocked.Decrement(ref _referenceCount); | ||
} | ||
|
||
public RefCountBox() | ||
{ | ||
Acquire(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Qynit.PulseGen.Server; | ||
|
||
internal static class DisposableExtensions | ||
{ | ||
public static ArcUnsafe<T> ToArc<T>(this T disposable) where T : IDisposable | ||
{ | ||
return new ArcUnsafe<T>(disposable); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Qynit.PulseGen.Server.Hubs; | ||
|
||
public interface IPlotClient | ||
{ | ||
Task ReceiveNames(IEnumerable<string> names); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Microsoft.AspNetCore.SignalR; | ||
|
||
namespace Qynit.PulseGen.Server.Hubs; | ||
|
||
public class PlotHub : Hub<IPlotClient> | ||
{ | ||
public const string Uri = "/plot/hub"; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@inherits LayoutComponentBase | ||
|
||
<PageTitle>PulseGen Viewer</PageTitle> | ||
|
||
<main> @Body </main> |
2 changes: 1 addition & 1 deletion
2
src/Qynit.PulseGen.Server/ChannelInfo.cs → ...nit.PulseGen.Server/Models/ChannelInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Qynit.PulseGen.Server/HannShapeInfo.cs → ...t.PulseGen.Server/Models/HannShapeInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using MessagePack; | ||
|
||
namespace Qynit.PulseGen.Server.Models; | ||
|
||
[Union(0, typeof(PlayDto))] | ||
[Union(1, typeof(ShiftPhaseDto))] | ||
[Union(2, typeof(SetPhaseDto))] | ||
[Union(3, typeof(ShiftFrequencyDto))] | ||
[Union(4, typeof(SetFrequencyDto))] | ||
[Union(5, typeof(SwapPhaseDto))] | ||
public abstract record InstructionDto; |
2 changes: 1 addition & 1 deletion
2
....PulseGen.Server/InterpolatedShapeInfo.cs → ...en.Server/Models/InterpolatedShapeInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/Qynit.PulseGen.Server/PulseGenRequest.cs → ...PulseGen.Server/Models/PulseGenRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
using MessagePack; | ||
|
||
namespace Qynit.PulseGen.Server; | ||
namespace Qynit.PulseGen.Server.Models; | ||
|
||
[MessagePackObject] | ||
public sealed record PulseGenRequest( | ||
[property: Key(0)] IList<ChannelInfo> ChannelTable, | ||
[property: Key(1)] IList<ShapeInfo> ShapeTable, | ||
[property: Key(2)] IEnumerable<Instruction> Instructions); | ||
[property: Key(2)] IEnumerable<InstructionDto> Instructions); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using MessagePack; | ||
|
||
namespace Qynit.PulseGen.Server.Models; | ||
|
||
[MessagePackObject] | ||
public sealed class PulseGenResponse : IDisposable | ||
{ | ||
[Key(0)] | ||
public IList<PooledComplexArray<double>> Waveforms { get; set; } = null!; | ||
|
||
private readonly List<ArcUnsafe<PooledComplexArray<double>>> _disposables = null!; | ||
|
||
public PulseGenResponse() { } | ||
|
||
public PulseGenResponse(List<ArcUnsafe<PooledComplexArray<double>>> waveforms) | ||
{ | ||
_disposables = waveforms; | ||
Waveforms = _disposables.Select(x => x.Target).ToList(); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
foreach (var disposable in _disposables) | ||
{ | ||
disposable.Dispose(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using MessagePack; | ||
|
||
namespace Qynit.PulseGen.Server.Models; | ||
|
||
[MessagePackObject] | ||
public sealed class ScheduleRequest | ||
{ | ||
[Key(0)] | ||
public IList<ChannelInfo>? ChannelTable { get; init; } | ||
[Key(1)] | ||
public IList<ShapeInfo>? ShapeTable { get; init; } | ||
[Key(2)] | ||
public ScheduleElementDto? Schedule { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using MessagePack; | ||
|
||
namespace Qynit.PulseGen.Server.Models; | ||
|
||
[MessagePackObject] | ||
public sealed record SetFrequencyDto( | ||
[property: Key(0)] double Time, | ||
[property: Key(1)] int ChannelId, | ||
[property: Key(2)] double Frequency) : InstructionDto; |
Oops, something went wrong.