repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/src/pull_timeline.rs
safekeeper/src/pull_timeline.rs
use std::cmp::min; use std::io::{self, ErrorKind}; use std::ops::RangeInclusive; use std::sync::Arc; use anyhow::{Context, Result, anyhow, bail}; use bytes::Bytes; use camino::Utf8PathBuf; use chrono::{DateTime, Utc}; use futures::{SinkExt, StreamExt, TryStreamExt}; use http::StatusCode; use http_utils::error::ApiErro...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/src/recovery.rs
safekeeper/src/recovery.rs
//! This module implements pulling WAL from peer safekeepers if compute can't //! provide it, i.e. safekeeper lags too much. use std::fmt; use std::pin::pin; use std::time::SystemTime; use anyhow::{Context, bail}; use futures::StreamExt; use postgres_protocol::message::backend::ReplicationMessage; use reqwest::Certif...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/src/send_wal.rs
safekeeper/src/send_wal.rs
//! This module implements the streaming side of replication protocol, starting //! with the "START_REPLICATION" message, and registry of walsenders. use std::cmp::{max, min}; use std::net::SocketAddr; use std::sync::Arc; use std::time::Duration; use anyhow::{Context as AnyhowContext, bail}; use bytes::Bytes; use fut...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/src/control_file_upgrade.rs
safekeeper/src/control_file_upgrade.rs
//! Code to deal with safekeeper control file upgrades use std::vec; use anyhow::{Result, bail}; use postgres_versioninfo::PgVersionId; use pq_proto::SystemId; use safekeeper_api::membership::{Configuration, INVALID_GENERATION}; use safekeeper_api::{ServerInfo, Term}; use serde::{Deserialize, Serialize}; use tracing::...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/src/wal_storage.rs
safekeeper/src/wal_storage.rs
//! This module has everything to deal with WAL -- reading and writing to disk. //! //! Safekeeper WAL is stored in the timeline directory, in format similar to pg_wal. //! PG timeline is always 1, so WAL segments are usually have names like this: //! - 000000010000000000000001 //! - 000000010000000000000002.partial //...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/src/patch_control_file.rs
safekeeper/src/patch_control_file.rs
use std::sync::Arc; use serde::{Deserialize, Serialize}; use serde_json::Value; use tracing::info; use crate::state::TimelinePersistentState; use crate::timeline::Timeline; #[derive(Deserialize, Debug, Clone)] pub struct Request { /// JSON object with fields to update pub updates: serde_json::Value, /// ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/src/wal_backup_partial.rs
safekeeper/src/wal_backup_partial.rs
//! Safekeeper timeline has a background task which is subscribed to `commit_lsn` //! and `flush_lsn` updates. //! //! After the partial segment was updated (`flush_lsn` was changed), the segment //! will be uploaded to S3 within the configured `partial_backup_timeout`. //! //! The filename format for partial segments ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/src/bin/safekeeper.rs
safekeeper/src/bin/safekeeper.rs
// // Main entry point for the safekeeper executable // use std::fs::{self, File}; use std::io::{ErrorKind, Write}; use std::str::FromStr; use std::sync::Arc; use std::time::{Duration, Instant}; use anyhow::{Context, Result, bail}; use camino::{Utf8Path, Utf8PathBuf}; use clap::{ArgAction, Parser}; use futures::future...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/src/http/mod.rs
safekeeper/src/http/mod.rs
pub mod routes; use std::sync::Arc; pub use routes::make_router; pub use safekeeper_api::models; use tokio_util::sync::CancellationToken; use crate::{GlobalTimelines, SafeKeeperConf}; pub async fn task_main_http( conf: Arc<SafeKeeperConf>, http_listener: std::net::TcpListener, global_timelines: Arc<Globa...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/src/http/routes.rs
safekeeper/src/http/routes.rs
use std::collections::HashMap; use std::fmt; use std::io::Write as _; use std::str::FromStr; use std::sync::Arc; use http_utils::endpoint::{ self, ChannelWriter, auth_middleware, check_permission_with, profile_cpu_handler, profile_heap_handler, prometheus_metrics_handler, request_span, }; use http_utils::error...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/tests/random_test.rs
safekeeper/tests/random_test.rs
use rand::Rng; use tracing::{info, warn}; use crate::walproposer_sim::log::{init_logger, init_tracing_logger}; use crate::walproposer_sim::simulation::{TestConfig, generate_network_opts, generate_schedule}; use crate::walproposer_sim::simulation_logs::validate_events; pub mod walproposer_sim; // Generates 500 random...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/tests/simple_test.rs
safekeeper/tests/simple_test.rs
use tracing::info; use utils::lsn::Lsn; use crate::walproposer_sim::log::init_logger; use crate::walproposer_sim::simulation::TestConfig; pub mod walproposer_sim; // Check that first start of sync_safekeepers() returns 0/0 on empty safekeepers. #[test] fn sync_empty_safekeepers() { let clock = init_logger(); ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/tests/misc_test.rs
safekeeper/tests/misc_test.rs
use std::sync::Arc; use tracing::{info, warn}; use utils::lsn::Lsn; use crate::walproposer_sim::log::{init_logger, init_tracing_logger}; use crate::walproposer_sim::simulation::{ Schedule, TestAction, TestConfig, generate_network_opts, generate_schedule, }; pub mod walproposer_sim; // Test that simulation suppo...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/tests/walproposer_sim/simulation.rs
safekeeper/tests/walproposer_sim/simulation.rs
use std::cell::Cell; use std::str::FromStr; use std::sync::Arc; use desim::executor::{self, ExternalHandle}; use desim::node_os::NodeOs; use desim::options::{Delay, NetworkOptions}; use desim::proto::{AnyMessage, NodeEvent}; use desim::world::{Node, World}; use rand::{Rng, SeedableRng}; use tracing::{debug, info_span,...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/tests/walproposer_sim/walproposer_disk.rs
safekeeper/tests/walproposer_sim/walproposer_disk.rs
use std::ffi::CStr; use std::sync::Arc; use parking_lot::{Mutex, MutexGuard}; use postgres_ffi::v16::wal_generator::{LogicalMessageGenerator, WalGenerator}; use utils::lsn::Lsn; use super::block_storage::BlockStorage; /// Simulation implementation of walproposer WAL storage. pub struct DiskWalProposer { state: M...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/tests/walproposer_sim/safekeeper_disk.rs
safekeeper/tests/walproposer_sim/safekeeper_disk.rs
use std::collections::HashMap; use std::ops::Deref; use std::sync::Arc; use std::time::Instant; use anyhow::Result; use bytes::{Buf, BytesMut}; use futures::future::BoxFuture; use parking_lot::Mutex; use postgres_ffi::waldecoder::WalStreamDecoder; use postgres_ffi::{PgMajorVersion, XLogSegNo}; use safekeeper::metrics:...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/tests/walproposer_sim/log.rs
safekeeper/tests/walproposer_sim/log.rs
use std::fmt; use std::sync::Arc; use desim::time::Timing; use once_cell::sync::OnceCell; use parking_lot::Mutex; use tracing_subscriber::fmt::format::Writer; use tracing_subscriber::fmt::time::FormatTime; /// SimClock can be plugged into tracing logger to print simulation time. #[derive(Clone)] pub struct SimClock {...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/tests/walproposer_sim/safekeeper.rs
safekeeper/tests/walproposer_sim/safekeeper.rs
//! Safekeeper communication endpoint to WAL proposer (compute node). //! Gets messages from the network, passes them down to consensus module and //! sends replies back. use std::collections::HashMap; use std::sync::Arc; use std::time::Duration; use anyhow::{Result, bail}; use bytes::{Bytes, BytesMut}; use camino::U...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/tests/walproposer_sim/walproposer_api.rs
safekeeper/tests/walproposer_sim/walproposer_api.rs
use std::cell::{RefCell, RefMut, UnsafeCell}; use std::ffi::CStr; use std::sync::Arc; use bytes::Bytes; use desim::executor::{self, PollSome}; use desim::network::TCP; use desim::node_os::NodeOs; use desim::proto::{AnyMessage, NetEvent, NodeEvent}; use desim::world::NodeId; use tracing::debug; use utils::lsn::Lsn; use...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/tests/walproposer_sim/mod.rs
safekeeper/tests/walproposer_sim/mod.rs
pub mod block_storage; pub mod log; pub mod safekeeper; pub mod safekeeper_disk; pub mod simulation; pub mod simulation_logs; pub mod walproposer_api; pub mod walproposer_disk;
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/tests/walproposer_sim/block_storage.rs
safekeeper/tests/walproposer_sim/block_storage.rs
use std::collections::HashMap; const BLOCK_SIZE: usize = 8192; /// A simple in-memory implementation of a block storage. Can be used to implement external /// storage in tests. pub struct BlockStorage { blocks: HashMap<u64, [u8; BLOCK_SIZE]>, } impl Default for BlockStorage { fn default() -> Self { S...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/tests/walproposer_sim/simulation_logs.rs
safekeeper/tests/walproposer_sim/simulation_logs.rs
use desim::proto::SimEvent; use tracing::debug; #[derive(Debug, Clone, PartialEq, Eq)] enum NodeKind { Unknown, Safekeeper, WalProposer, } impl Default for NodeKind { fn default() -> Self { Self::Unknown } } /// Simulation state of walproposer/safekeeper, derived from the simulation logs....
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/benches/receive_wal.rs
safekeeper/benches/receive_wal.rs
//! WAL ingestion benchmarks. use std::io::Write as _; use bytes::BytesMut; use camino_tempfile::tempfile; use criterion::{BatchSize, Bencher, Criterion, criterion_group, criterion_main}; use itertools::Itertools as _; use postgres_ffi::v17::wal_generator::{LogicalMessageGenerator, WalGenerator}; use pprof::criterion...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/client/src/mgmt_api.rs
safekeeper/client/src/mgmt_api.rs
//! Safekeeper http client. //! //! Partially copied from pageserver client; some parts might be better to be //! united. use std::error::Error as _; use http_utils::error::HttpErrorBody; use reqwest::{IntoUrl, Method, Response, StatusCode}; use safekeeper_api::models::{ self, PullTimelineRequest, PullTimelineRes...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/safekeeper/client/src/lib.rs
safekeeper/client/src/lib.rs
pub mod mgmt_api;
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/test_runner/pg_clients/rust/tokio-postgres/src/main.rs
test_runner/pg_clients/rust/tokio-postgres/src/main.rs
use std::env::VarError; use tokio_postgres; fn get_env(key: &str) -> String { match std::env::var(key) { Ok(val) => val, Err(VarError::NotPresent) => panic!("{key} env variable not set"), Err(VarError::NotUnicode(_)) => panic!("{key} is not valid unicode"), } } #[tokio::main(flavor = "...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/workspace_hack/build.rs
workspace_hack/build.rs
// A build script is required for cargo to consider build dependencies. fn main() {}
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/workspace_hack/src/lib.rs
workspace_hack/src/lib.rs
// This is a stub lib.rs.
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/storage_broker/build.rs
storage_broker/build.rs
fn main() -> Result<(), Box<dyn std::error::Error>> { // Generate rust code from .proto protobuf. // // Note: we previously tried to use deterministic location at proto/ for // easy location, but apparently interference with cachepot sometimes fails // the build then. Anyway, per cargo docs build sc...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/storage_broker/src/lib.rs
storage_broker/src/lib.rs
use std::time::Duration; use proto::TenantTimelineId as ProtoTenantTimelineId; use proto::broker_service_client::BrokerServiceClient; use tonic::Status; use tonic::codegen::StdError; use tonic::transport::{Channel, Endpoint}; use utils::id::{TenantId, TenantTimelineId, TimelineId}; // Code generated by protobuf. pub ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/storage_broker/src/metrics.rs
storage_broker/src/metrics.rs
//! Broker metrics. use metrics::{IntCounter, IntGauge, register_int_counter, register_int_gauge}; use once_cell::sync::Lazy; pub static NUM_PUBS: Lazy<IntGauge> = Lazy::new(|| { register_int_gauge!("storage_broker_active_publishers", "Number of publications") .expect("Failed to register metric") }); pub...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/storage_broker/src/bin/storage_broker.rs
storage_broker/src/bin/storage_broker.rs
//! Simple pub-sub based on grpc (tonic) and Tokio broadcast channel for storage //! nodes messaging. //! //! Subscriptions to 1) single timeline 2) all timelines are possible. We could //! add subscription to the set of timelines to save grpc streams, but testing //! shows many individual streams is also ok. //! //! M...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/storage_broker/benches/rps.rs
storage_broker/benches/rps.rs
use std::sync::Arc; use std::sync::atomic::{AtomicU64, Ordering}; use std::time::{Duration, Instant}; use clap::Parser; use storage_broker::proto::{ FilterTenantTimelineId, MessageType, SafekeeperTimelineInfo, SubscribeByFilterRequest, TenantTimelineId as ProtoTenantTimelineId, TypeSubscription, TypedMessage, ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/tenant_size_model/src/lib.rs
libs/tenant_size_model/src/lib.rs
//! Synthetic size calculation #![deny(unsafe_code)] #![deny(clippy::undocumented_unsafe_blocks)] mod calculation; pub mod svg; /// StorageModel is the input to the synthetic size calculation. /// /// It represents a tree of timelines, with just the information that's needed /// for the calculation. This doesn't trac...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/tenant_size_model/src/svg.rs
libs/tenant_size_model/src/svg.rs
use crate::{SegmentMethod, SegmentSizeResult, SizeResult, StorageModel}; use std::fmt::Write; const SVG_WIDTH: f32 = 500.0; /// Different branch kind for SVG drawing. #[derive(PartialEq)] pub enum SvgBranchKind { Timeline, Lease, } struct SvgDraw<'a> { storage: &'a StorageModel, branches: &'a [String...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/tenant_size_model/src/calculation.rs
libs/tenant_size_model/src/calculation.rs
use crate::{SegmentMethod, SegmentSizeResult, SizeResult, StorageModel}; // // *-g--*---D---> // / // / // / *---b----*-B---> // / / // / / // -----*--e---*-----f----* C // E ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/tenant_size_model/tests/tests.rs
libs/tenant_size_model/tests/tests.rs
//! Tenant size model tests. use tenant_size_model::{Segment, SizeResult, StorageModel}; use std::collections::HashMap; struct ScenarioBuilder { segments: Vec<Segment>, /// Mapping from the branch name to the index of a segment describing its latest state. branches: HashMap<String, usize>, } impl Scena...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/walproposer/build.rs
libs/walproposer/build.rs
//! Links with walproposer, pgcommon, pgport and runs bindgen on walproposer.h //! to generate Rust bindings for it. use std::env; use std::path::PathBuf; use std::process::Command; use anyhow::{Context, anyhow}; const WALPROPOSER_PG_VERSION: &str = "v17"; fn main() -> anyhow::Result<()> { // Tell cargo to inva...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/walproposer/src/lib.rs
libs/walproposer/src/lib.rs
pub mod bindings { #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] // bindgen creates some unsafe code with no doc comments. #![allow(clippy::missing_safety_doc)] // noted at 1.63 that in many cases there's a u32 -> u32 transmutes in bindgen code. ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/walproposer/src/walproposer.rs
libs/walproposer/src/walproposer.rs
#![allow(clippy::todo)] use std::ffi::CString; use std::str::FromStr; use postgres_ffi::WAL_SEGMENT_SIZE; use utils::id::TenantTimelineId; use utils::lsn::Lsn; use crate::api_bindings::{Level, create_api, take_vec_u8}; use crate::bindings::{ NeonWALReadResult, Safekeeper, WalProposer, WalProposerBroadcast, WalPr...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/walproposer/src/api_bindings.rs
libs/walproposer/src/api_bindings.rs
//! A C-Rust shim: defines implementation of C walproposer API, assuming wp //! callback_data stores Box to some Rust implementation. #![allow(dead_code)] use std::ffi::{CStr, CString}; use crate::bindings::{ NeonWALReadResult, PGAsyncReadResult, PGAsyncWriteResult, Safekeeper, Size, StringInfoData, Timestam...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-types2/src/lib.rs
libs/proxy/postgres-types2/src/lib.rs
//! Conversions to and from Postgres types. //! //! This crate is used by the `tokio-postgres` and `postgres` crates. You normally don't need to depend directly on it //! unless you want to define your own `ToSql` or `FromSql` definitions. #![warn(clippy::all, missing_docs)] use std::any::type_name; use std::error::Er...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-types2/src/type_gen.rs
libs/proxy/postgres-types2/src/type_gen.rs
// Autogenerated file - DO NOT EDIT use std::sync::Arc; use crate::{Kind, Oid, Type}; #[derive(PartialEq, Eq, Debug, Hash)] pub struct Other { pub name: String, pub oid: Oid, pub kind: Kind, pub schema: String, } #[derive(PartialEq, Eq, Clone, Debug, Hash)] pub enum Inner { Bool, Bytea, C...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-types2/src/private.rs
libs/proxy/postgres-types2/src/private.rs
use std::error::Error; pub use bytes::BytesMut; use crate::{FromSql, Type}; pub fn read_be_i32(buf: &mut &[u8]) -> Result<i32, Box<dyn Error + Sync + Send>> { if buf.len() < 4 { return Err("invalid buffer size".into()); } let mut bytes = [0; 4]; bytes.copy_from_slice(&buf[..4]); *buf = &b...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/config.rs
libs/proxy/tokio-postgres2/src/config.rs
//! Connection configuration. use std::net::IpAddr; use std::time::Duration; use std::{fmt, str}; pub use postgres_protocol2::authentication::sasl::ScramKeys; use postgres_protocol2::message::frontend::StartupMessageParams; use serde::{Deserialize, Serialize}; use tokio::io::{AsyncRead, AsyncWrite}; use tokio::net::T...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/tls.rs
libs/proxy/tokio-postgres2/src/tls.rs
//! TLS support. use std::error::Error; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use std::{fmt, io}; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; pub(crate) mod private { pub struct ForcePrivateApi; } /// Channel binding information returned from a TLS handshake. pub struc...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/cancel_query.rs
libs/proxy/tokio-postgres2/src/cancel_query.rs
use tokio::net::TcpStream; use crate::client::SocketConfig; use crate::config::{Host, SslMode}; use crate::tls::MakeTlsConnect; use crate::{Error, cancel_query_raw, connect_socket}; pub(crate) async fn cancel_query<T>( config: SocketConfig, ssl_mode: SslMode, tls: T, process_id: i32, secret_key: i...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/connect_tls.rs
libs/proxy/tokio-postgres2/src/connect_tls.rs
use bytes::BytesMut; use postgres_protocol2::message::frontend; use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; use crate::Error; use crate::config::SslMode; use crate::maybe_tls_stream::MaybeTlsStream; use crate::tls::TlsConnect; use crate::tls::private::ForcePrivateApi; pub async fn connect_tls...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/lib.rs
libs/proxy/tokio-postgres2/src/lib.rs
//! An asynchronous, pipelined, PostgreSQL client. #![warn(clippy::all)] use postgres_protocol2::message::backend::ReadyForQueryBody; pub use crate::cancel_token::{CancelToken, RawCancelToken}; pub use crate::client::{Client, SocketConfig}; pub use crate::config::Config; pub use crate::connection::Connection; pub use...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/generic_client.rs
libs/proxy/tokio-postgres2/src/generic_client.rs
#![allow(async_fn_in_trait)] use crate::query::RowStream; use crate::{Client, Error, Transaction}; mod private { pub trait Sealed {} } /// A trait allowing abstraction over connections and transactions. /// /// This trait is "sealed", and cannot be implemented outside of this crate. pub trait GenericClient: priv...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/simple_query.rs
libs/proxy/tokio-postgres2/src/simple_query.rs
use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll}; use fallible_iterator::FallibleIterator; use futures_util::{Stream, ready}; use pin_project_lite::pin_project; use postgres_protocol2::message::backend::Message; use tracing::debug; use crate::client::{InnerClient, Responses}; use crate::{Error, R...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/cancel_token.rs
libs/proxy/tokio-postgres2/src/cancel_token.rs
use serde::{Deserialize, Serialize}; use tokio::io::{AsyncRead, AsyncWrite}; use tokio::net::TcpStream; use crate::client::SocketConfig; use crate::config::SslMode; use crate::tls::{MakeTlsConnect, TlsConnect}; use crate::{Error, cancel_query, cancel_query_raw}; /// A cancellation token that allows easy cancellation ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/row.rs
libs/proxy/tokio-postgres2/src/row.rs
//! Rows. use std::ops::Range; use std::sync::Arc; use std::{fmt, str}; use fallible_iterator::FallibleIterator; use postgres_protocol2::message::backend::DataRowBody; use postgres_types2::{Format, WrongFormat}; use crate::row::sealed::{AsName, Sealed}; use crate::simple_query::SimpleColumn; use crate::statement::Co...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/codec.rs
libs/proxy/tokio-postgres2/src/codec.rs
use std::io; use bytes::BytesMut; use fallible_iterator::FallibleIterator; use postgres_protocol2::message::backend; use tokio::sync::mpsc::UnboundedSender; use tokio_util::codec::{Decoder, Encoder}; pub enum FrontendMessage { Raw(BytesMut), RecordNotices(RecordNotices), } pub struct RecordNotices { pub ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/connect.rs
libs/proxy/tokio-postgres2/src/connect.rs
use std::net::IpAddr; use futures_util::TryStreamExt; use postgres_protocol2::message::backend::Message; use tokio::io::{AsyncRead, AsyncWrite}; use tokio::net::TcpStream; use tokio::sync::mpsc; use crate::client::SocketConfig; use crate::config::{Host, SslMode}; use crate::connect_raw::StartupStream; use crate::conn...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/connection.rs
libs/proxy/tokio-postgres2/src/connection.rs
use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use bytes::BytesMut; use fallible_iterator::FallibleIterator; use futures_util::{Sink, StreamExt, ready}; use postgres_protocol2::message::backend::{Message, NoticeResponseBody}; use postgres_protocol2::message::frontend; use tokio::io::{Async...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/maybe_tls_stream.rs
libs/proxy/tokio-postgres2/src/maybe_tls_stream.rs
//! MaybeTlsStream. //! //! Represents a stream that may or may not be encrypted with TLS. use std::io; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use crate::tls::{ChannelBinding, TlsStream}; /// A stream that may or may not be encrypted with TLS. pub enum May...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/client.rs
libs/proxy/tokio-postgres2/src/client.rs
use std::collections::HashMap; use std::fmt; use std::net::IpAddr; use std::task::{Context, Poll}; use std::time::Duration; use bytes::BytesMut; use fallible_iterator::FallibleIterator; use futures_util::{TryStreamExt, future, ready}; use postgres_protocol2::message::backend::Message; use postgres_protocol2::message::...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/types.rs
libs/proxy/tokio-postgres2/src/types.rs
//! Types. //! //! This module is a reexport of the `postgres_types` crate. #[doc(inline)] pub use postgres_types2::*;
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/statement.rs
libs/proxy/tokio-postgres2/src/statement.rs
use std::fmt; use std::sync::Arc; use crate::types::Type; use postgres_protocol2::Oid; use postgres_protocol2::message::backend::Field; struct StatementInner { name: &'static str, columns: Vec<Column>, } /// A prepared statement. /// /// Prepared statements can only be used with the connection that created t...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/transaction_builder.rs
libs/proxy/tokio-postgres2/src/transaction_builder.rs
use crate::{Client, Error, Transaction}; /// The isolation level of a database transaction. #[derive(Debug, Copy, Clone)] #[non_exhaustive] pub enum IsolationLevel { /// Equivalent to `ReadCommitted`. ReadUncommitted, /// An individual statement in the transaction will see rows committed before it began. ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/query.rs
libs/proxy/tokio-postgres2/src/query.rs
use std::pin::Pin; use std::task::{Context, Poll}; use bytes::BufMut; use futures_util::{Stream, ready}; use postgres_protocol2::message::backend::Message; use postgres_protocol2::message::frontend; use postgres_types2::Format; use crate::client::{CachedTypeInfo, InnerClient, Responses}; use crate::{Error, ReadyForQu...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/cancel_query_raw.rs
libs/proxy/tokio-postgres2/src/cancel_query_raw.rs
use bytes::BytesMut; use postgres_protocol2::message::frontend; use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt}; use crate::config::SslMode; use crate::tls::TlsConnect; use crate::{Error, connect_tls}; pub async fn cancel_query_raw<S, T>( stream: S, mode: SslMode, tls: T, process_id: i32, se...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/prepare.rs
libs/proxy/tokio-postgres2/src/prepare.rs
use bytes::BytesMut; use fallible_iterator::FallibleIterator; use postgres_protocol2::IsNull; use postgres_protocol2::message::backend::{Message, RowDescriptionBody}; use postgres_protocol2::message::frontend; use postgres_protocol2::types::oid_to_sql; use postgres_types2::Format; use crate::client::{CachedTypeInfo, P...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/connect_socket.rs
libs/proxy/tokio-postgres2/src/connect_socket.rs
use std::future::Future; use std::io; use std::net::{IpAddr, SocketAddr}; use std::time::Duration; use tokio::net::{self, TcpStream}; use tokio::time; use crate::Error; use crate::config::Host; pub(crate) async fn connect_socket( host_addr: Option<IpAddr>, host: &Host, port: u16, connect_timeout: Opt...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/connect_raw.rs
libs/proxy/tokio-postgres2/src/connect_raw.rs
use std::io; use std::pin::Pin; use std::task::{Context, Poll, ready}; use bytes::BytesMut; use fallible_iterator::FallibleIterator; use futures_util::{SinkExt, Stream, TryStreamExt}; use postgres_protocol2::authentication::sasl; use postgres_protocol2::authentication::sasl::ScramSha256; use postgres_protocol2::messag...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/transaction.rs
libs/proxy/tokio-postgres2/src/transaction.rs
use crate::query::RowStream; use crate::{CancelToken, Client, Error, ReadyForQueryStatus}; /// A representation of a PostgreSQL database transaction. /// /// Transactions will implicitly roll back when dropped. Use the `commit` method to commit the changes made in the /// transaction. Transactions can be nested, with ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/error/mod.rs
libs/proxy/tokio-postgres2/src/error/mod.rs
//! Errors. use std::error::{self, Error as _Error}; use std::{fmt, io}; use fallible_iterator::FallibleIterator; use postgres_protocol2::message::backend::{ErrorFields, ErrorResponseBody}; pub use self::sqlstate::*; #[allow(clippy::unreadable_literal)] pub mod sqlstate; /// The severity of a Postgres error or not...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/tokio-postgres2/src/error/sqlstate.rs
libs/proxy/tokio-postgres2/src/error/sqlstate.rs
//! Rust repr for <https://www.postgresql.org/docs/current/errcodes-appendix.html> /// A SQLSTATE error code #[derive(PartialEq, Eq, Clone, Debug)] pub struct SqlState([u8; 5]); impl SqlState { /// Creates a `SqlState` from its error code. pub fn from_code(s: &str) -> SqlState { let mut code = [b'0'; ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-protocol2/src/lib.rs
libs/proxy/postgres-protocol2/src/lib.rs
//! Low level Postgres protocol APIs. //! //! This crate implements the low level components of Postgres's communication //! protocol, including message and value serialization and deserialization. //! It is designed to be used as a building block by higher level APIs such as //! `rust-postgres`, and should not typical...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-protocol2/src/password/test.rs
libs/proxy/postgres-protocol2/src/password/test.rs
use crate::password; #[tokio::test] async fn test_encrypt_scram_sha_256() { // Specify the salt to make the test deterministic. Any bytes will do. let salt: [u8; 16] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; assert_eq!( password::scram_sha_256_salt(b"secret", salt).await, "...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-protocol2/src/password/mod.rs
libs/proxy/postgres-protocol2/src/password/mod.rs
//! Functions to encrypt a password in the client. //! //! This is intended to be used by client applications that wish to //! send commands like `ALTER USER joe PASSWORD 'pwd'`. The password //! need not be sent in cleartext if it is encrypted on the client //! side. This is good because it ensures the cleartext passw...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-protocol2/src/escape/test.rs
libs/proxy/postgres-protocol2/src/escape/test.rs
use crate::escape::{escape_identifier, escape_literal}; #[test] fn test_escape_idenifier() { assert_eq!(escape_identifier("foo"), String::from("\"foo\"")); assert_eq!(escape_identifier("f\\oo"), String::from("\"f\\oo\"")); assert_eq!(escape_identifier("f'oo"), String::from("\"f'oo\"")); assert_eq!(esca...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-protocol2/src/escape/mod.rs
libs/proxy/postgres-protocol2/src/escape/mod.rs
//! Provides functions for escaping literals and identifiers for use //! in SQL queries. //! //! Prefer parameterized queries where possible. Do not escape //! parameters in a parameterized query. #[cfg(test)] mod test; /// Escape a literal and surround result with single quotes. Not /// recommended in most cases. //...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-protocol2/src/authentication/mod.rs
libs/proxy/postgres-protocol2/src/authentication/mod.rs
//! Authentication protocol support. pub mod sasl;
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-protocol2/src/authentication/sasl.rs
libs/proxy/postgres-protocol2/src/authentication/sasl.rs
//! SASL-based authentication support. use std::fmt::Write; use std::{io, iter, mem, str}; use base64::Engine as _; use base64::prelude::BASE64_STANDARD; use hmac::{Hmac, Mac}; use rand::{self, Rng}; use sha2::digest::FixedOutput; use sha2::{Digest, Sha256}; use tokio::task::yield_now; const NONCE_LENGTH: usize = 24...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-protocol2/src/types/test.rs
libs/proxy/postgres-protocol2/src/types/test.rs
use bytes::{Buf, BytesMut}; use super::*; #[test] fn ltree_sql() { let mut query = vec![1u8]; query.extend_from_slice("A.B.C".as_bytes()); let mut buf = BytesMut::new(); ltree_to_sql("A.B.C", &mut buf); assert_eq!(query.as_slice(), buf.chunk()); } #[test] fn ltree_str() { let mut query = v...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-protocol2/src/types/mod.rs
libs/proxy/postgres-protocol2/src/types/mod.rs
//! Conversions to and from Postgres's binary format for various types. use std::boxed::Box as StdBox; use std::error::Error; use std::str; use byteorder::{BigEndian, ReadBytesExt}; use bytes::{BufMut, BytesMut}; use fallible_iterator::FallibleIterator; use crate::Oid; #[cfg(test)] mod test; /// Serializes a `TEXT`...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-protocol2/src/message/backend.rs
libs/proxy/postgres-protocol2/src/message/backend.rs
#![allow(missing_docs)] use std::io::{self, Read}; use std::ops::Range; use std::{cmp, str}; use byteorder::{BigEndian, ByteOrder, ReadBytesExt}; use bytes::{Bytes, BytesMut}; use fallible_iterator::FallibleIterator; use memchr::memchr; use crate::Oid; // top-level message tags const PARSE_COMPLETE_TAG: u8 = b'1'; ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-protocol2/src/message/mod.rs
libs/proxy/postgres-protocol2/src/message/mod.rs
//! Postgres message protocol support. //! //! See [Postgres's documentation][docs] for more information on message flow. //! //! [docs]: https://www.postgresql.org/docs/9.5/static/protocol-flow.html pub mod backend; pub mod frontend;
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/postgres-protocol2/src/message/frontend.rs
libs/proxy/postgres-protocol2/src/message/frontend.rs
//! Frontend message serialization. #![allow(missing_docs)] use std::error::Error; use std::{io, marker}; use byteorder::{BigEndian, ByteOrder}; use bytes::{Buf, BufMut, BytesMut}; use crate::{FromUsize, IsNull, Oid, write_nullable}; #[inline] fn write_body<F, E>(buf: &mut BytesMut, f: F) -> Result<(), E> where ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/json/src/lib.rs
libs/proxy/json/src/lib.rs
//! A JSON serialization lib, designed for more flexibility than `serde_json` offers. //! //! Features: //! //! ## Dynamic construction //! //! Sometimes you have dynamic values you want to serialize, that are not already in a serde-aware model like a struct or a Vec etc. //! To achieve this with serde, you need to imp...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/json/src/value.rs
libs/proxy/json/src/value.rs
use core::fmt; use std::collections::{BTreeMap, HashMap}; use crate::str::{format_escaped_fmt, format_escaped_str}; use crate::{KeyEncoder, ObjectSer, ValueSer, value_as_list, value_as_object}; /// Write a value to the underlying json representation. pub trait ValueEncoder { fn encode(self, v: ValueSer<'_>); } p...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/json/src/macros.rs
libs/proxy/json/src/macros.rs
//! # Examples //! //! ``` //! use futures::{StreamExt, TryStream, TryStreamExt}; //! //! async fn stream_to_json_list<S, T, E>(mut s: S) -> Result<String, E> //! where //! S: TryStream<Ok = T, Error = E> + Unpin, //! T: json::ValueEncoder //! { //! Ok(json::value_to_string!(|val| json::value_as_list!(|val|...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/json/src/str.rs
libs/proxy/json/src/str.rs
//! Helpers for serializing escaped strings. //! //! ## License //! //! <https://github.com/serde-rs/json/blob/c1826ebcccb1a520389c6b78ad3da15db279220d/src/ser.rs#L1514-L1552> //! <https://github.com/serde-rs/json/blob/c1826ebcccb1a520389c6b78ad3da15db279220d/src/ser.rs#L2081-L2157> //! Licensed by David Tolnay under M...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/proxy/subzero_core/src/lib.rs
libs/proxy/subzero_core/src/lib.rs
// This is a stub for the subzero-core crate.
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/consumption_metrics/src/lib.rs
libs/consumption_metrics/src/lib.rs
//! Shared code for consumption metics collection #![deny(unsafe_code)] #![deny(clippy::undocumented_unsafe_blocks)] use chrono::{DateTime, Utc}; use rand::Rng; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd)] #[serde(tag = "type")] pub enum Eve...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/posthog_client_lite/src/lib.rs
libs/posthog_client_lite/src/lib.rs
//! A lite version of the PostHog client that only supports local evaluation of feature flags. mod background_loop; pub use background_loop::FeatureResolverBackgroundLoop; use std::collections::HashMap; use serde::{Deserialize, Serialize}; use serde_json::json; use sha2::Digest; #[derive(Debug, thiserror::Error)] ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/posthog_client_lite/src/background_loop.rs
libs/posthog_client_lite/src/background_loop.rs
//! A background loop that fetches feature flags from PostHog and updates the feature store. use std::{ sync::Arc, time::{Duration, SystemTime}, }; use arc_swap::ArcSwap; use tokio_util::sync::CancellationToken; use tracing::{Instrument, info_span}; use crate::{ CaptureEvent, FeatureStore, LocalEvaluatio...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/vm_monitor/src/filecache.rs
libs/vm_monitor/src/filecache.rs
//! Logic for configuring and scaling the Postgres file cache. use std::num::NonZeroU64; use anyhow::{Context, anyhow}; use tokio_postgres::types::ToSql; use tokio_postgres::{Client, NoTls, Row}; use tokio_util::sync::CancellationToken; use tracing::{error, info}; use crate::MiB; /// Manages Postgres' file cache by...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/vm_monitor/src/lib.rs
libs/vm_monitor/src/lib.rs
#![deny(unsafe_code)] #![deny(clippy::undocumented_unsafe_blocks)] #![cfg(target_os = "linux")] use std::fmt::Debug; use std::net::SocketAddr; use std::time::Duration; use anyhow::Context; use axum::Router; use axum::extract::ws::WebSocket; use axum::extract::{State, WebSocketUpgrade}; use axum::response::Response; u...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/vm_monitor/src/runner.rs
libs/vm_monitor/src/runner.rs
//! Exposes the `Runner`, which handles messages received from agent and //! sends upscale requests. //! //! This is the "Monitor" part of the monitor binary and is the main entrypoint for //! all functionality. use std::fmt::Debug; use std::time::{Duration, Instant}; use anyhow::{Context, bail}; use axum::extract::w...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/vm_monitor/src/dispatcher.rs
libs/vm_monitor/src/dispatcher.rs
//! Managing the websocket connection and other signals in the monitor. //! //! Contains types that manage the interaction (not data interchange, see `protocol`) //! between agent and monitor, allowing us to to process and send messages in a //! straightforward way. The dispatcher also manages that signals that come fr...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/vm_monitor/src/cgroup.rs
libs/vm_monitor/src/cgroup.rs
use std::fmt::{self, Debug, Formatter}; use std::time::{Duration, Instant}; use anyhow::{Context, anyhow}; use cgroups_rs::Subsystem; use cgroups_rs::hierarchies::{self, is_cgroup2_unified_mode}; use cgroups_rs::memory::MemController; use tokio::sync::watch; use tracing::{info, warn}; /// Configuration for a `CgroupW...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/vm_monitor/src/protocol.rs
libs/vm_monitor/src/protocol.rs
//! Types representing protocols and actual agent-monitor messages. //! //! The pervasive use of serde modifiers throughout this module is to ease //! serialization on the go side. Because go does not have enums (which model //! messages well), it is harder to model messages, and we accomodate that with //! serde. //! ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/vm_monitor/src/bin/monitor.rs
libs/vm_monitor/src/bin/monitor.rs
// We expose a standalone binary _and_ start the monitor in `compute_ctl` so that // we can test the monitor as part of the entire autoscaling system in // neondatabase/autoscaling. // // The monitor was previously started by vm-builder, and for testing purposes, // we can mimic that setup with this binary. #[cfg(targ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/pq_proto/src/lib.rs
libs/pq_proto/src/lib.rs
//! Postgres protocol messages serialization-deserialization. See //! <https://www.postgresql.org/docs/devel/protocol-message-formats.html> //! on message formats. #![deny(clippy::undocumented_unsafe_blocks)] pub mod framed; use std::borrow::Cow; use std::{fmt, io, str}; use byteorder::{BigEndian, ReadBytesExt}; use...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/pq_proto/src/framed.rs
libs/pq_proto/src/framed.rs
//! Provides `Framed` -- writing/flushing and reading Postgres messages to/from //! the async stream based on (and buffered with) BytesMut. All functions are //! cancellation safe. //! //! It is similar to what tokio_util::codec::Framed with appropriate codec //! provides, but `FramedReader` and `FramedWriter` read/wri...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/http-utils/src/failpoints.rs
libs/http-utils/src/failpoints.rs
use hyper::{Body, Request, Response, StatusCode}; use serde::{Deserialize, Serialize}; use tokio_util::sync::CancellationToken; use utils::failpoint_support::apply_failpoint; use crate::error::ApiError; use crate::json::{json_request, json_response}; pub type ConfigureFailpointsRequest = Vec<FailpointConfig>; /// In...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/libs/http-utils/src/lib.rs
libs/http-utils/src/lib.rs
pub mod endpoint; pub mod error; pub mod failpoints; pub mod json; pub mod request; pub mod server; pub mod tls_certs; extern crate hyper0 as hyper; /// Current fast way to apply simple http routing in various Neon binaries. /// Re-exported for sake of uniform approach, that could be later replaced with better altern...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false