This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::sync::Arc; | |
| use tokio::sync::Mutex; | |
| use uuid::Uuid; | |
| pub struct SpeculativeSession { | |
| pub session_id: Uuid, | |
| pub prompt_tokens: Vec<u32>, | |
| pub generated_tokens: Vec<u32>, | |
| pub draft_lookahead: usize, | |
| pub temperature: f32, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Static Envoy configuration demonstrating inline, hardcoded session ticket keys. | |
| # DO NOT USE THIS IN PRODUCTION: Rotating keys requires a full configuration reload or process restart. | |
| static_resources: | |
| listeners: | |
| - name: ingress_edge | |
| address: | |
| socket_address: | |
| address: 0.0.0.0 | |
| port_value: 443 | |
| filter_chains: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Robust schema for high-throughput scheduled tasks | |
| CREATE TABLE scheduled_tasks ( | |
| id BIGSERIAL PRIMARY KEY, | |
| task_type VARCHAR(64) NOT NULL, | |
| payload JSONB NOT NULL DEFAULT '{}', | |
| run_at TIMESTAMPTZ NOT NULL, | |
| status VARCHAR(20) NOT NULL DEFAULT 'queued', | |
| max_retries INT NOT NULL DEFAULT 3, | |
| retry_count INT NOT NULL DEFAULT 0, | |
| error_log TEXT, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use sha2::{Sha256, Digest}; | |
| use serde::{Serialize, Deserialize}; | |
| #[derive(Debug, Serialize, Deserialize, Clone)] | |
| pub struct ChatMessage { | |
| pub role: String, | |
| pub content: String, | |
| #[serde(skip_serializing_if = "Option::is_none")] | |
| pub name: Option<String>, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: payment-service | |
| namespace: production | |
| spec: | |
| replicas: 10 | |
| template: | |
| spec: | |
| containers: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ratelimit | |
| import ( | |
| "context" | |
| "fmt" | |
| "time" | |
| "github.com/google/uuid" | |
| "github.com/redis/go-redis/v9" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "encoding/base32" | |
| "fmt" | |
| "net" | |
| "os" | |
| "strings" | |
| "time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <queue> | |
| #include <mutex> | |
| #include <condition_variable> | |
| #include <chrono> | |
| #include <vector> | |
| #include <optional> | |
| template <typename T> | |
| class ConcurrentBatchQueue { | |
| public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "settings": { | |
| "index": { | |
| "number_of_shards": 3, | |
| "number_of_replicas": 1, | |
| "refresh_interval": "30s", | |
| "codec": "best_compression" | |
| } | |
| }, | |
| "mappings": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: spire.spiffe.io/v1alpha1 | |
| kind: ClusterSPIFFEID | |
| metadata: | |
| name: payment-service-spiffeid | |
| spec: | |
| spiffeIdTemplate: "spiffe://prod.example.org/ns/{{ .PodMeta.Namespace }}/sa/{{ .PodSpec.ServiceAccountName }}" | |
| podSelector: | |
| matchLabels: | |
| app: payment-service | |
| workloadSelector: |