Shuffle modules around, add new RelayInfo (not used yet)

This commit is contained in:
Mike Dilger 2023-02-06 15:56:28 +13:00
parent 5fee75cb6e
commit b8464cf52d
6 changed files with 26 additions and 12 deletions

View File

@ -5,7 +5,8 @@ use crate::feed::Feed;
use crate::fetcher::Fetcher;
use crate::people::People;
use crate::relationship::Relationship;
use crate::relay_assignment::{RelayAssignment, RelayPicker};
use crate::relay_info::RelayAssignment;
use crate::relay_picker::RelayPicker;
use crate::settings::Settings;
use crate::signer::Signer;
use nostr_types::{Event, Id, Profile, PublicKeyHex, RelayUrl};

View File

@ -17,7 +17,8 @@ mod overlord;
mod people;
mod process;
mod relationship;
mod relay_assignment;
mod relay_info;
mod relay_picker;
mod settings;
mod signer;
mod tags;

View File

@ -5,7 +5,7 @@ use crate::db::{DbEvent, DbEventSeen, DbPersonRelay, DbRelay, Direction};
use crate::error::Error;
use crate::globals::GLOBALS;
use crate::people::People;
use crate::relay_assignment::RelayPicker;
use crate::relay_picker::RelayPicker;
use crate::tags::{
add_event_to_tags, add_pubkey_hex_to_tags, add_pubkey_to_tags, add_subject_to_tags_if_missing,
keys_from_text, notes_from_text,

19
src/relay_info.rs Normal file
View File

@ -0,0 +1,19 @@
use crate::db::DbRelay;
use nostr_types::PublicKeyHex;
/// All the per-relay information we need kept hot in memory
#[derive(Debug, Clone)]
pub struct RelayInfo {
pub dbrelay: DbRelay,
pub connected: bool,
pub assignments: Vec<RelayAssignment>,
pub subscriptions: Vec<String>,
}
/// A RelayAssignment is a record of a relay which is serving (or will serve) the general
/// feed for a set of public keys.
#[derive(Debug, Clone)]
pub struct RelayAssignment {
pub relay: DbRelay,
pub pubkeys: Vec<PublicKeyHex>,
}

View File

@ -1,18 +1,11 @@
use crate::db::{DbPersonRelay, DbRelay, Direction};
use crate::error::Error;
use crate::globals::GLOBALS;
use crate::relay_info::RelayAssignment;
use nostr_types::{PublicKeyHex, RelayUrl};
use std::collections::HashMap;
use std::fmt;
/// A RelayAssignment is a record of a relay which is serving (or will serve) the general
/// feed for a set of public keys.
#[derive(Debug, Clone)]
pub struct RelayAssignment {
pub relay: DbRelay,
pub pubkeys: Vec<PublicKeyHex>,
}
/// Ways that the RelayPicker can fail
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(clippy::enum_variant_names)]

View File

@ -1,7 +1,7 @@
use super::{GossipUi, Page};
use crate::db::DbRelay;
use crate::globals::GLOBALS;
use crate::relay_assignment::RelayAssignment;
use crate::relay_info::RelayAssignment;
use eframe::egui;
use egui::{Context, ScrollArea, SelectableLabel, Ui};
use egui_extras::{Column, TableBuilder};