diff options
| author | Kyle <kyle.sutherlandcash@gmail.com> | 2021-01-17 19:15:32 +0000 |
|---|---|---|
| committer | Kyle <kyle.sutherlandcash@gmail.com> | 2021-01-17 19:15:32 +0000 |
| commit | 09b1e038431f5348d5b4d66cccc58f950ab40934 (patch) | |
| tree | 6feff50b4cdad063d78d216a9779d3c8e90b10df /src | |
| parent | feat(infra): initial plugin system (diff) | |
| download | sl0ppij-09b1e038431f5348d5b4d66cccc58f950ab40934.tar.gz sl0ppij-09b1e038431f5348d5b4d66cccc58f950ab40934.tar.xz sl0ppij-09b1e038431f5348d5b4d66cccc58f950ab40934.zip | |
Add some message types for server-client comms
Diffstat (limited to 'src')
| -rw-r--r-- | src/ipc.rs | 46 | ||||
| -rw-r--r-- | src/main.rs | 1 |
2 files changed, 47 insertions, 0 deletions
diff --git a/src/ipc.rs b/src/ipc.rs new file mode 100644 index 00000000..0bfc0451 --- /dev/null +++ b/src/ipc.rs @@ -0,0 +1,46 @@ +// IPC stuff for starting to split things into a client and server model +use std::collections::HashSet; +use serde::{Serialize, Deserialize}; + +type SessionID = u64; + +#[derive(PartialEq, Eq, Serialize, Deserialize, Hash)] +pub struct Session { + // Unique ID for this session + id: SessionID, + // Identifier for the underlying IPC primitive (socket, pipe) + conn_name: String, + // User configured alias for the session + alias: String, +} + +// How do we want to connect to a session? +#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +pub enum ClientType { + Reader, + Writer, +} + +// Types of messages sent from the client to the server +#[derive(Serialize, Deserialize)] +pub enum ClientToServerMsg { + // List which sessions are available + ListSessions, + // Create a new session + CreateSession, + // Attach to a running session + AttachToSession(SessionID, ClientType), + // Force detach + DetachSession(SessionID), + // Disconnect from the session we're connected to + DisconnectFromSession, +} + +// Types of messages sent from the server to the client +// @@@ Implement Serialize and Deserialize for this... +pub enum ServerToClientMsg { + // Info about a particular session + SessionInfo(Session), + // A list of sessions + SessionList(HashSet<Session>), +}
\ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 84dfac62..64bc2816 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,7 @@ mod cli; mod command_is_executing; mod errors; mod input; +mod ipc; mod layout; mod os_input_output; mod panes; |
