Skip to content

Instantly share code, notes, and snippets.

View arjunsk's full-sized avatar
:octocat:
Learning!

Arjun Sunil Kumar arjunsk

:octocat:
Learning!
View GitHub Profile
@arjunsk
arjunsk / FrostDB.go
Created December 30, 2023 23:24
Ways of Building Query Plan
// LogicalPlan is a logical representation of a query. Each LogicalPlan is a
// sub-tree of the query. It is built recursively.
type LogicalPlan struct {
Input *LogicalPlan
// Each LogicalPlan struct must only have one of the following.
SchemaScan *SchemaScan
TableScan *TableScan
Filter *Filter
Distinct *Distinct
/**
* Returns a heap-allocated iterator over the contents of the
* database.
* <p>
* Caller should close the iterator when it is no longer needed.
* The returned iterator should be closed before this db is closed.
* <p>
* <pre>
* KVIterator it = unsafeLocalIterator();
* try {
public class DefaultRheaKVStore implements RheaKVStore {
private static final Logger LOG = LoggerFactory
.getLogger(DefaultRheaKVStore.class);
static {
ExtSerializerSupports.init();
}
private final StateListenerContainer<Long> stateListenerContainer = new StateListenerContainer<>();
* <pre>
* 1. The first step is to filter out region1, region2, and region3 from the routing table.
*
* ┌─────────────────┐ ┌─────────────────┐
* │ scan startKey │ │ scan endKey │
* └────────┬────────┘ └────────┬────────┘
* │ │
* │ │
* │ │
* ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ ┌ ─ ─ ─ ─ ─ ─ ┐ ┌ ─ ─ ─ ─ ─ ─ ┐ │ ┌ ─ ─ ─ ─ ─ ─ ┐
/**
* Returns current placement driver client instance.
*/
PlacementDriverClient getPlacementDriverClient();
/**
* Add a listener for the state change of the leader with
* this region.
* <p>
* In a special case, if that is a single region environment,
* then regionId = -1 as the input parameter.
*/
void addLeaderStateListener(final long regionId, final LeaderStateListener listener);
/**
/**
* Creates a distributed lock implementation that provides
* exclusive access to a shared resource.
* <p>
* <pre>
* DistributedLock<byte[]> lock = ...;
* if (lock.tryLock()) {
* try {
* // manipulate protected state
* } finally {
* <pre>
* ┌────────────────────────────┐
* │ │
* │ RheaKVStore │────────────────┐
* │ │ │
* └────────────────────────────┘ ▼
* │ ▲ ┌────────────────────────────┐
* │ │ │ PlacementDriverClient │
* │ │ └────────────────────────────┘
* │ │ │
struct MinStack {
stack: Vec< (i32, i32) >,
min: i32,
}
/**
* `&self` means the method takes an immutable reference.
* If you need a mutable reference, change it to `&mut self` instead.
*/
use crate::{Connection, Frame};
use tracing::{debug, instrument};
/// Represents an "unknown" command. This is not a real `Redis` command.
#[derive(Debug)]
pub struct Unknown {
command_name: String,
}