Skip to main content

Dsn

Struct Dsn 

Source
pub struct Dsn { /* private fields */ }
Expand description

Parsed DSN (Data Source Name) for Geode connections.

Contains all connection parameters extracted from a DSN string.

Implementations§

Source§

impl Dsn

Source

pub fn parse(dsn: &str) -> Result<Self>

Parse a DSN string into a Dsn struct.

§Supported formats
  • quic://host:port?options - QUIC transport (recommended)
  • grpc://host:port?options - gRPC transport
  • host:port?options - Defaults to QUIC
§Supported options (query parameters)
  • tls - Enable/disable TLS (0/1/true/false, default: true)
  • insecure, skip_verify, insecure_skip_verify - Skip TLS verification
  • page_size - Results page size (default: 1000)
  • client_name or hello_name - Client name
  • client_version or hello_ver - Client version
  • conformance - GQL conformance level
  • username or user - Authentication username
  • password or pass - Authentication password
  • ca or ca_cert - Path to CA certificate
  • cert or client_cert - Path to client certificate (mTLS)
  • key or client_key - Path to client key (mTLS)
  • server_name - SNI server name
  • connect_timeout or timeout - Connection timeout in seconds
§Errors

Returns Error::InvalidDsn if:

  • DSN is empty
  • Scheme is unsupported
  • Host is missing
  • Port is invalid
§Examples
use geode_client::dsn::Dsn;

let dsn = Dsn::parse("quic://localhost:3141").unwrap();
let dsn = Dsn::parse("grpc://127.0.0.1:50051?tls=0").unwrap();
let dsn = Dsn::parse("grpc://[::1]:50051").unwrap();
Source

pub fn transport(&self) -> Transport

Get the transport protocol.

Source

pub fn host(&self) -> &str

Get the host.

Source

pub fn port(&self) -> u16

Get the port.

Source

pub fn username(&self) -> Option<&str>

Get the username if specified.

Source

pub fn password(&self) -> Option<&str>

Get the password if specified.

Source

pub fn tls_enabled(&self) -> bool

Check if TLS is enabled.

Source

pub fn skip_verify(&self) -> bool

Check if TLS verification should be skipped.

Source

pub fn page_size(&self) -> usize

Get the page size.

Source

pub fn client_name(&self) -> &str

Get the client name.

Source

pub fn client_version(&self) -> &str

Get the client version.

Source

pub fn conformance(&self) -> &str

Get the conformance level.

Source

pub fn options(&self) -> &HashMap<String, String>

Get additional options.

Source

pub fn ca_cert(&self) -> Option<&str>

Get the CA certificate path if specified.

Source

pub fn client_cert(&self) -> Option<&str>

Get the client certificate path if specified.

Source

pub fn client_key(&self) -> Option<&str>

Get the client key path if specified.

Source

pub fn server_name(&self) -> Option<&str>

Get the SNI server name if specified.

Source

pub fn connect_timeout_secs(&self) -> Option<u64>

Get the connection timeout in seconds if specified.

Source

pub fn address(&self) -> String

Get the host:port address string.

Trait Implementations§

Source§

impl Clone for Dsn

Source§

fn clone(&self) -> Dsn

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Dsn

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Dsn

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Dsn

§

impl RefUnwindSafe for Dsn

§

impl Send for Dsn

§

impl Sync for Dsn

§

impl Unpin for Dsn

§

impl UnwindSafe for Dsn

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more