diff --git a/rivetkit-rust/packages/rivetkit-core/src/actor/context.rs b/rivetkit-rust/packages/rivetkit-core/src/actor/context.rs index a6fd28139d..89e245de11 100644 --- a/rivetkit-rust/packages/rivetkit-core/src/actor/context.rs +++ b/rivetkit-rust/packages/rivetkit-core/src/actor/context.rs @@ -323,22 +323,37 @@ impl ActorContext { ctx } + #[deprecated( + note = "Actor KV is deprecated. Use embedded SQLite (`sql()`) or actor state instead." + )] pub async fn kv_batch_get(&self, keys: &[&[u8]]) -> Result>>> { self.0.kv.batch_get(keys).await } + #[deprecated( + note = "Actor KV is deprecated. Use embedded SQLite (`sql()`) or actor state instead." + )] pub async fn kv_batch_put(&self, entries: &[(&[u8], &[u8])]) -> Result<()> { self.0.kv.batch_put(entries).await } + #[deprecated( + note = "Actor KV is deprecated. Use embedded SQLite (`sql()`) or actor state instead." + )] pub async fn kv_batch_delete(&self, keys: &[&[u8]]) -> Result<()> { self.0.kv.batch_delete(keys).await } + #[deprecated( + note = "Actor KV is deprecated. Use embedded SQLite (`sql()`) or actor state instead." + )] pub async fn kv_delete_range(&self, start: &[u8], end: &[u8]) -> Result<()> { self.0.kv.delete_range(start, end).await } + #[deprecated( + note = "Actor KV is deprecated. Use embedded SQLite (`sql()`) or actor state instead." + )] pub async fn kv_list_prefix( &self, prefix: &[u8], @@ -347,6 +362,9 @@ impl ActorContext { self.0.kv.list_prefix(prefix, opts).await } + #[deprecated( + note = "Actor KV is deprecated. Use embedded SQLite (`sql()`) or actor state instead." + )] pub async fn kv_list_range( &self, start: &[u8], @@ -356,10 +374,21 @@ impl ActorContext { self.0.kv.list_range(start, end, opts).await } + #[deprecated( + note = "Actor KV is deprecated. Use embedded SQLite (`sql()`) or actor state instead." + )] pub fn kv(&self) -> &Kv { &self.0.kv } + /// Internal accessor for the actor KV store. Core uses KV as the backing + /// store for the inspector token and actor startup persistence. Unlike the + /// public `kv()` accessor, this is not deprecated because the storage + /// machinery itself is not going away, only the public actor-facing API. + pub(crate) fn kv_internal(&self) -> &Kv { + &self.0.kv + } + pub fn sql(&self) -> &SqliteDb { &self.0.sql } diff --git a/rivetkit-rust/packages/rivetkit-core/src/actor/task.rs b/rivetkit-rust/packages/rivetkit-core/src/actor/task.rs index 3cb939cf42..c87602edc5 100644 --- a/rivetkit-rust/packages/rivetkit-core/src/actor/task.rs +++ b/rivetkit-rust/packages/rivetkit-core/src/actor/task.rs @@ -1260,7 +1260,7 @@ impl ActorTask { let mut values = self .ctx - .kv() + .kv_internal() .batch_get(&[PERSIST_DATA_KEY, LAST_PUSHED_ALARM_KEY]) .await .context("load persisted actor startup data")? @@ -1298,7 +1298,7 @@ impl ActorTask { } self.ctx - .kv() + .kv_internal() .get(key) .await .context("load persisted actor startup key") diff --git a/rivetkit-rust/packages/rivetkit-core/src/inspector/auth.rs b/rivetkit-rust/packages/rivetkit-core/src/inspector/auth.rs index 3fd170f5b8..e147221660 100644 --- a/rivetkit-rust/packages/rivetkit-core/src/inspector/auth.rs +++ b/rivetkit-rust/packages/rivetkit-core/src/inspector/auth.rs @@ -58,7 +58,7 @@ impl InspectorAuth { } let stored_token = ctx - .kv() + .kv_internal() .get(&INSPECTOR_TOKEN_KEY) .await .ok() @@ -91,7 +91,7 @@ pub(crate) async fn init_inspector_token_with_preload( match preloaded_kv.and_then(|preloaded| preloaded.key_entry(&INSPECTOR_TOKEN_KEY)) { Some(existing) => existing, None => ctx - .kv() + .kv_internal() .get(&INSPECTOR_TOKEN_KEY) .await .context("load inspector token")?, @@ -101,7 +101,7 @@ pub(crate) async fn init_inspector_token_with_preload( } let token = generate_inspector_token(); - ctx.kv() + ctx.kv_internal() .put(&INSPECTOR_TOKEN_KEY, token.as_bytes()) .await .context("persist inspector token")?; diff --git a/rivetkit-rust/packages/rivetkit/src/context.rs b/rivetkit-rust/packages/rivetkit/src/context.rs index 25e4f0e514..8775ad2c98 100644 --- a/rivetkit-rust/packages/rivetkit/src/context.rs +++ b/rivetkit-rust/packages/rivetkit/src/context.rs @@ -211,6 +211,10 @@ impl Ctx { self.inner.region() } + #[deprecated( + note = "Actor KV is deprecated. Use embedded SQLite (`sql()`) or actor state instead." + )] + #[allow(deprecated)] pub fn kv(&self) -> &Kv { self.inner.kv() } diff --git a/rivetkit-typescript/packages/rivetkit/src/actor/config.ts b/rivetkit-typescript/packages/rivetkit/src/actor/config.ts index ea94448566..2d16893efa 100644 --- a/rivetkit-typescript/packages/rivetkit/src/actor/config.ts +++ b/rivetkit-typescript/packages/rivetkit/src/actor/config.ts @@ -62,6 +62,10 @@ type ActorKvListOptions< type ActorClientFor = T extends Registry ? Client : T; +/** + * @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db` / `c.sql`) + * or actor state instead. + */ export interface ActorKv { get( key: Uint8Array | string, @@ -305,6 +309,10 @@ export interface ActorContext< [RAW_STATE_SYMBOL](): TState; state: TState; vars: TVars; + /** + * @deprecated Actor KV is deprecated. Use embedded SQLite (`db` / `sql`) + * or actor state instead. + */ readonly kv: ActorKv; readonly db: InferDatabaseClient; readonly schedule: ActorSchedule; diff --git a/website/src/sitemap/mod.ts b/website/src/sitemap/mod.ts index 5fac6910b7..2df20006c9 100644 --- a/website/src/sitemap/mod.ts +++ b/website/src/sitemap/mod.ts @@ -299,11 +299,6 @@ export const sitemap = [ // icon: faSitemap, collapsible: true, pages: [ - { - title: "Low-Level KV Storage", - href: "/docs/actors/kv", - badge: "Deprecated", - }, { title: "SQLite + Drizzle", href: "/docs/actors/sqlite-drizzle",