Skip to content
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

Query history from history server #143

Merged
merged 24 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
298a257
[WIP] Query history from history server
progval Oct 26, 2024
b7369a8
LATEST impl with blanks to fill
progval Oct 26, 2024
2c0eaad
[WIP] decouple send_item
progval Oct 27, 2024
2ef9b6a
Make HistoryService return an inflated event instead of HistoryLogEntry
progval Oct 27, 2024
c93e5bd
Merge branch 'master' into remote-history-service
progval Oct 27, 2024
e5aa0e0
Finish HistoryRequest::Latest in pg_history_service
progval Oct 27, 2024
682bbf7
Partial fill-in-the-blanks for message translation
spb Oct 27, 2024
a8874b6
Add missing files
progval Oct 27, 2024
f0ac38d
Make target a String in case it expired
progval Oct 27, 2024
9b88fca
Make id a MessageId
progval Oct 27, 2024
96661e9
sable_history: Add support for running migrations on startup
progval Oct 27, 2024
984de4d
pg_history_service: Fix LATEST logic
progval Oct 27, 2024
d56db83
Make sure server-time is consistent between echoes and CHATHISTORY
progval Oct 27, 2024
71ae9c1
Update down.sql
progval Oct 27, 2024
b87c630
Split make_historical_event out of get_entries
progval Oct 28, 2024
82d4546
Implement BEFORE/AFTER/BETWEEN
progval Oct 28, 2024
60a6fac
Implement TieredHistoryService::list_targets
progval Oct 28, 2024
3859cf8
Merge branch 'master' into remote-history-service
progval Nov 2, 2024
bdcc1e6
Finish implementing TieredHistoryService
progval Nov 2, 2024
89143da
Remove unused dependency on async-trait
progval Nov 2, 2024
0b245bf
Remove unused enum HistoryMessage
progval Nov 2, 2024
61f78eb
Remove panics
progval Nov 2, 2024
a8f711b
Deduplicate query collection
progval Nov 9, 2024
ffd8f83
Implement Around
progval Nov 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 89 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion sable_history/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ built = { version = "0.5", features = [ "git2" ] }
sable_network = { path = "../sable_network" }
sable_server = { path = "../sable_server" }

futures = "0.3"
tokio = { version = "1.14", features = [ "full" ] }
serde = { version = "1", features = [ "derive" ] }
serde_with = "1.11"
Expand All @@ -22,7 +23,9 @@ tracing = "0.1"
anyhow = "1.0"
clap = { version = "4.5", features = [ "derive" ] }
chrono = "0.4"
itertools = "0.10"
uuid = { version = "1.9.1", features = ["v7", "fast-rng", "serde"] }

diesel = { version = "2.2", features = [ "postgres", "chrono", "uuid" ] }
diesel-async = { version = "0.5", features = [ "postgres" ] }
diesel-async = { version = "0.5", features = [ "postgres", "tokio", "async-connection-wrapper" ] }
diesel_migrations = "2.2.0"
3 changes: 3 additions & 0 deletions sable_history/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
fn main() {
// https://docs.rs/diesel_migrations/2.2.0/diesel_migrations/macro.embed_migrations.html#automatic-rebuilds
println!("cargo:rerun-if-changed=migrations/");

built::write_built_file().expect("Failed to acquire build-time information");
}
1 change: 1 addition & 0 deletions sable_history/diesel.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[print_schema]
file = "src/schema.rs"
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
import_types = ["crate::type::*"]

[migrations_directory]
dir = "migrations"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE
DROP COLUMN message_type MessageType NOT NULL;

DROP TYPE "MessageType";
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CREATE TYPE "Message_Type" AS ENUM ('privmsg', 'notice');

ALTER TABLE messages
ADD COLUMN message_type "Message_Type" NOT NULL;
3 changes: 3 additions & 0 deletions sable_history/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
mod pg_history_service;
pub use pg_history_service::PgHistoryService;
mod server;
pub use server::*;

mod models;
mod schema;
mod types;
1 change: 1 addition & 0 deletions sable_history/src/models/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ pub struct Message {
pub source_user: i32,
pub target_channel: i64,
pub text: String,
pub message_type: crate::types::MessageType,
}
Loading
Loading