work (new network + db initial working state)

This commit is contained in:
2026-02-15 16:59:47 -05:00
parent a8b55f669f
commit 8be13e14bc
14 changed files with 418 additions and 232 deletions

View File

@@ -17,6 +17,8 @@ pub enum ServerMsgInst {
ServerErrorV0(ServerErrorV0) = 3,
}
pub type UserIdV0 = u64;
#[derive(Debug, bitcode::Encode, bitcode::Decode)]
pub struct CreateAccountV0 {
pub username: String,
@@ -56,7 +58,7 @@ pub struct SendMsgV0 {
#[derive(Debug, Clone, bitcode::Encode, bitcode::Decode)]
pub struct LoadMsgV0 {
pub content: String,
pub user: String,
pub author: UserIdV0,
}
#[derive(Debug, bitcode::Encode, bitcode::Decode)]

View File

@@ -21,6 +21,7 @@ pub type LoadMsg = LoadMsgV0;
pub type ServerError = ServerErrorV0;
pub type CreateAccount = CreateAccountV0;
pub type AccountCreated = AccountCreatedV0;
pub type UserId = UserIdV0;
impl From<CreateAccount> for ClientMsg {
fn from(value: CreateAccount) -> Self {
@@ -33,3 +34,15 @@ impl From<ServerError> for ServerMsg {
Self::ServerError(value)
}
}
impl From<LoadMsg> for ServerMsg {
fn from(value: LoadMsg) -> Self {
Self::LoadMsg(value)
}
}
impl From<AccountCreated> for ServerMsg {
fn from(value: AccountCreated) -> Self {
Self::AccountCreated(value)
}
}

View File

@@ -21,12 +21,12 @@ impl RequestId {
#[derive(Debug, bitcode::Encode, bitcode::Decode)]
pub struct ClientRequestMsg {
pub request_id: Option<RequestId>,
pub id: RequestId,
pub msg: ClientMsgInst,
}
#[derive(Debug, bitcode::Encode, bitcode::Decode)]
pub struct ServerRespMsg {
pub request_id: Option<RequestId>,
pub id: Option<RequestId>,
pub msg: ServerMsgInst,
}