- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3
wip: pushing to talk structure with @ttd #174
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You like this?
| <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath> | ||
| </PropertyGroup> | ||
|  | ||
| <PropertyGroup Condition="'$(Configuration)'=='Release'"> | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be worth using configurations more liberally so dockerfiles, workflows, etc. could just pass configurations and the meanings could be contained in a propertygroup like this.
| namespace Peer.Daemon.Linux | ||
| { | ||
| internal class Program | ||
| { | ||
| private const string _socketPath = "/var/run/peerless/peerless.sock"; | ||
| static async Task Main() | ||
| { | ||
| Directory.CreateDirectory(Directory.GetParent(_socketPath)!.FullName); | ||
| File.Delete(_socketPath); | ||
|  | ||
| var app = ServerBuilder.CreateHost(cfg => | ||
| { | ||
| cfg.WebHost.UseKestrel(kestrel => | ||
| { | ||
| kestrel.ListenUnixSocket(_socketPath, opts => | ||
| { | ||
| opts.Protocols = HttpProtocols.Http2; | ||
| }); | ||
| }); | ||
| }); | ||
|  | ||
| await app.RunAsync(); | ||
| } | ||
| } | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| namespace Peer.Daemon.Linux | |
| { | |
| internal class Program | |
| { | |
| private const string _socketPath = "/var/run/peerless/peerless.sock"; | |
| static async Task Main() | |
| { | |
| Directory.CreateDirectory(Directory.GetParent(_socketPath)!.FullName); | |
| File.Delete(_socketPath); | |
| var app = ServerBuilder.CreateHost(cfg => | |
| { | |
| cfg.WebHost.UseKestrel(kestrel => | |
| { | |
| kestrel.ListenUnixSocket(_socketPath, opts => | |
| { | |
| opts.Protocols = HttpProtocols.Http2; | |
| }); | |
| }); | |
| }); | |
| await app.RunAsync(); | |
| } | |
| } | |
| } | |
| namespace Peer.Daemon.Linux; | |
| internal class Program | |
| { | |
| private const string _socketPath = "/var/run/peerless/peerless.sock"; | |
| static async Task Main() | |
| { | |
| Directory.CreateDirectory(Directory.GetParent(_socketPath)!.FullName); | |
| File.Delete(_socketPath); | |
| var app = ServerBuilder.CreateHost(cfg => | |
| { | |
| cfg.WebHost.UseKestrel(kestrel => | |
| { | |
| kestrel.ListenUnixSocket(_socketPath, opts => | |
| { | |
| opts.Protocols = HttpProtocols.Http2; | |
| }); | |
| }); | |
| }); | |
| await app.RunAsync(); | |
| } | |
| } | 
| static async Task Main() | ||
| { | ||
| Directory.CreateDirectory(Directory.GetParent(_socketPath)!.FullName); | ||
| File.Delete(_socketPath); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this blow up an already running instance if a second one were started? I wonder if it would better to be aggressive about cleanup and fail to start if the socket is already open? I bet there's prior art about this somewhere.
| using Grpc.Net.Client; | ||
| using Peerless; | ||
|  | ||
| namespace Geas; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nerd
| // package peerless; | ||
|  | ||
| service PullRequestGrpcService { | ||
| rpc GetPullRequest(GetPullRequestRequest) returns (GetPullRequestResponse); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RequestRequest 🤮 I get it though.
| message State { | ||
| PRStatus status = 1; | ||
| int32 total_comments = 2; | ||
| int32 active_comments =3; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| int32 active_comments =3; | |
| int32 active_comments =3; | 
| var src = host.Services.GetRequiredService<EndpointDataSource>(); | ||
| return host; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src unused?
| } | ||
|  | ||
| //Linux | ||
| public partial class SpecialPaths | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't compile conditionally, wouldn't these paths end up being used on Windows too?
Just an initial experimenting branch I've had around for a bit where I'm trying to see how I wanna structure the Daemon stuff.
I've got separate projects for the Windows and linux daemons because I wanted to test if it would cause any differences with trimming etc. It doesn't seem to have any impact so I'll be merging them together again and probably going to nuke the Server project entirely.
Other than that I'm basically thinking of just using named pipes on windows and UDS on linux/mac to do IPC and then just polling in the background as we do now to populate a teeny SQLite server that we update. I figure it'd be kinda neat to do it with change streaming and tracking certain things though it's kinda hard because the GH api makes so few promises to you about the actual correctness of your data (looking at you status flags)
In order to do a bunch of this I had to bump to net 8 and preview versions (for named pipe support in kestrel). Also I added some really horrendous annotations on the generics to make them compatible with the trimming stuff but god I hope there's a better way to do it going forward. Those required C#11 to work properly.
edit: Oh also I was experimenting with the CodeGenerator configuration stuff but it wasn't working for me so I have it gated behind the Release-Preview build which I don't think I actually added atm.
edit2: I also added a little commandline util called 'Geas' to handle experimenting with it before implementing it in Peer