lmcache-cli 0.5.9.dev0__py3-none-any.whl → 0.5.9rc2.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (373) hide show
  1. lmcache/__init__.py +1 -1
  2. lmcache/_version.py +3 -3
  3. lmcache/cli/commands/__init__.py +1 -1
  4. lmcache/cli/commands/base.py +2 -2
  5. lmcache/cli/commands/bench/engine_bench/command.py +1 -1
  6. lmcache/cli/commands/bench/engine_bench/config.py +1 -1
  7. lmcache/cli/commands/bench/engine_bench/quality/alignment.py +1 -1
  8. lmcache/cli/commands/bench/engine_bench/quality/dataset.py +1 -1
  9. lmcache/cli/commands/bench/engine_bench/quality/scoring.py +1 -1
  10. lmcache/cli/commands/bench/engine_bench/request_sender.py +1 -1
  11. lmcache/cli/commands/bench/engine_bench/stats.py +1 -1
  12. lmcache/cli/commands/bench/engine_bench/tokenizers.py +1 -1
  13. lmcache/cli/commands/bench/engine_bench/workloads/__init__.py +1 -1
  14. lmcache/cli/commands/bench/engine_bench/workloads/base.py +1 -1
  15. lmcache/cli/commands/bench/engine_bench/workloads/kv_tier_pressure.py +1 -1
  16. lmcache/cli/commands/bench/engine_bench/workloads/long_doc_permutator.py +1 -1
  17. lmcache/cli/commands/bench/engine_bench/workloads/long_doc_qa.py +1 -1
  18. lmcache/cli/commands/bench/engine_bench/workloads/multi_round_chat.py +1 -1
  19. lmcache/cli/commands/bench/engine_bench/workloads/prefix_suffix_tuner.py +1 -1
  20. lmcache/cli/commands/bench/engine_bench/workloads/rag_qa_quality.py +1 -1
  21. lmcache/cli/commands/bench/engine_bench/workloads/random_prefill.py +1 -1
  22. lmcache/cli/commands/bench/l2_adapter_bench/runner.py +9 -6
  23. lmcache/cli/commands/bench/quality_bench/core/analyze_stage.py +1 -1
  24. lmcache/cli/commands/bench/quality_bench/core/blend_counters.py +1 -1
  25. lmcache/cli/commands/bench/quality_bench/core/judge.py +1 -1
  26. lmcache/cli/commands/bench/quality_bench/core/report.py +1 -1
  27. lmcache/cli/commands/bench/quality_bench/core/run_files.py +2 -2
  28. lmcache/cli/commands/bench/quality_bench/core/run_stage.py +1 -1
  29. lmcache/cli/commands/bench/quality_bench/core/runner.py +1 -1
  30. lmcache/cli/commands/bench/server_bench/arguments.py +3 -3
  31. lmcache/cli/commands/bench/server_bench/buffers.py +1 -1
  32. lmcache/cli/commands/bench/server_bench/client.py +4 -3
  33. lmcache/cli/commands/bench/server_bench/command.py +3 -3
  34. lmcache/cli/commands/coordinator.py +55 -2
  35. lmcache/cli/commands/kvcache.py +1 -1
  36. lmcache/cli/commands/memory.py +1 -1
  37. lmcache/cli/commands/query/_coordinator.py +1 -1
  38. lmcache/cli/commands/query/coordinator_command.py +1 -1
  39. lmcache/cli/commands/quota/_helpers.py +1 -1
  40. lmcache/cli/commands/server.py +1 -1
  41. lmcache/cli/commands/trace/_dispatch.py +1 -1
  42. lmcache/cli/commands/trace/_driver.py +1 -1
  43. lmcache/cli/commands/trace/_stats.py +1 -1
  44. lmcache/cli/commands/trace/replay_command.py +1 -1
  45. lmcache/cli/commands/trace/replay_events_command.py +1 -1
  46. lmcache/cli/main.py +2 -2
  47. lmcache/integration/atom/__init__.py +4 -0
  48. lmcache/integration/atom/multi_process_adapter.py +173 -11
  49. lmcache/integration/request_telemetry/fastapi.py +1 -1
  50. lmcache/integration/sglang/unified_lmcache_mp_connector.py +2 -2
  51. lmcache/integration/tensorrt_llm/__init__.py +9 -56
  52. lmcache/integration/tensorrt_llm/tensorrt_mp_adapter.py +5 -4
  53. lmcache/integration/vllm/experimental/__init__.py +10 -1
  54. lmcache/integration/vllm/experimental/dispatcher.py +22 -9
  55. lmcache/integration/vllm/experimental/q_metadata.py +142 -0
  56. lmcache/{sdk → integration/vllm/experimental}/qringbuffer.py +288 -92
  57. lmcache/integration/vllm/kv_cache_group_edits.py +7 -6
  58. lmcache/integration/vllm/kv_cache_groups.py +81 -8
  59. lmcache/integration/vllm/lazy_offload_manager.py +1 -1
  60. lmcache/integration/vllm/lazy_offload_policy/__init__.py +1 -1
  61. lmcache/integration/vllm/lazy_offload_policy/eviction_aware.py +1 -1
  62. lmcache/integration/vllm/lazy_offload_policy/fifo.py +1 -1
  63. lmcache/integration/vllm/lmcache_mp_connector.py +61 -24
  64. lmcache/integration/vllm/lmcache_mp_metadata.py +7 -0
  65. lmcache/integration/vllm/mp_lookup_state.py +1 -1
  66. lmcache/integration/vllm/mp_server_launcher.py +49 -22
  67. lmcache/integration/vllm/utils.py +6 -2
  68. lmcache/integration/vllm/vllm_multi_process_adapter.py +116 -29
  69. lmcache/lmcache_frontend/app.py +3 -3
  70. lmcache/sdk/__init__.py +1 -1
  71. lmcache/sdk/context.py +122 -22
  72. lmcache/sdk/kvcache.py +1 -1
  73. lmcache/sdk/qcache.py +1 -1
  74. lmcache/sdk/request.py +176 -19
  75. lmcache/sdk/wrapper/ring_mapping.py +4 -3
  76. lmcache/sdk/wrapper/ring_transfer.py +5 -3
  77. lmcache/security/__init__.py +4 -1
  78. lmcache/security/http.py +2 -2
  79. lmcache/tools/transfer_channel_benchmark/benchmark.py +1 -1
  80. lmcache/usage_telemetry/base.py +1 -1
  81. lmcache/usage_telemetry/flush.py +3 -3
  82. lmcache/usage_telemetry/guard.py +1 -1
  83. lmcache/usage_telemetry/identity.py +1 -1
  84. lmcache/usage_telemetry/l1_usage.py +1 -1
  85. lmcache/usage_telemetry/l2_usage.py +1 -1
  86. lmcache/usage_telemetry/mp.py +1 -1
  87. lmcache/usage_telemetry/mp_continuous.py +1 -1
  88. lmcache/usage_telemetry/transport.py +1 -1
  89. lmcache/utils.py +2 -620
  90. lmcache/v1/client/async_engine_driven.py +1 -1
  91. lmcache/v1/client/chunk_hashes.py +117 -0
  92. lmcache/v1/client/heartbeat.py +6 -2
  93. lmcache/v1/client/kv_event_subscriber.py +1 -1
  94. lmcache/v1/client/transfer_context/__init__.py +1 -4
  95. lmcache/v1/client/transfer_context/base.py +10 -31
  96. lmcache/v1/client/transfer_context/inline.py +131 -34
  97. lmcache/v1/client/transfer_context/shm.py +9 -58
  98. lmcache/v1/client/transport/factory.py +25 -6
  99. lmcache/v1/client/transport/grpc_impl/client.py +6 -5
  100. lmcache/v1/client/transport/zmq_impl/mq_client.py +4 -5
  101. lmcache/v1/client/transport/zmq_impl/polling_loop.py +1 -1
  102. lmcache/v1/client/worker_transfer.py +30 -10
  103. lmcache/v1/common/buffer_registration.py +38 -0
  104. lmcache/{sdk → v1/common}/cache_kind.py +42 -0
  105. lmcache/v1/common/custom_types.py +149 -10
  106. lmcache/v1/common/errors.py +12 -0
  107. lmcache/v1/common/kv_format/contiguity.py +1 -1
  108. lmcache/v1/common/kv_format/detection.py +2 -2
  109. lmcache/v1/common/kv_format/detectors/atom.py +1 -1
  110. lmcache/v1/common/kv_format/detectors/base.py +1 -1
  111. lmcache/v1/common/kv_format/detectors/registry.py +1 -1
  112. lmcache/v1/common/kv_format/detectors/sglang.py +1 -1
  113. lmcache/v1/common/kv_format/detectors/trtllm.py +1 -1
  114. lmcache/v1/common/kv_format/detectors/vllm.py +6 -13
  115. lmcache/v1/common/kv_format/specs/nl_x_nb_bs_nh_two_hs.py +1 -1
  116. lmcache/v1/common/kv_format/specs/nl_x_nb_nh_bs_two_hs.py +1 -1
  117. lmcache/v1/{kv_layer_groups.py → common/kv_layer_groups.py} +3 -5
  118. lmcache/{logging.py → v1/common/logging.py} +43 -0
  119. lmcache/v1/common/memory_management.py +509 -0
  120. lmcache/v1/common/metrics/metrics.py +1 -1
  121. lmcache/v1/{platform → common}/ops_types.py +2 -2
  122. lmcache/v1/{periodic_thread.py → common/periodic_thread.py} +2 -2
  123. lmcache/v1/common/security/__init__.py +1 -0
  124. lmcache/v1/{utils → common}/subclass_discovery.py +1 -1
  125. lmcache/v1/common/token_hasher.py +30 -2
  126. lmcache/v1/common/transfer_context.py +89 -0
  127. lmcache/v1/common/utils.py +122 -6
  128. lmcache/v1/distributed/api.py +47 -5
  129. lmcache/v1/distributed/config.py +7 -5
  130. lmcache/v1/distributed/internal_api.py +8 -0
  131. lmcache/v1/distributed/l1_manager/base.py +50 -1
  132. lmcache/v1/distributed/l1_manager/devdax.py +1 -1
  133. lmcache/v1/distributed/l1_manager/gds.py +1 -1
  134. lmcache/v1/distributed/l2_adapters/aerospike_l2_adapter.py +1 -1
  135. lmcache/v1/distributed/l2_adapters/base.py +1 -1
  136. lmcache/v1/distributed/l2_adapters/bigtable_key_encoder.py +3 -4
  137. lmcache/v1/distributed/l2_adapters/bigtable_l2_adapter.py +2 -2
  138. lmcache/v1/distributed/l2_adapters/config.py +1 -1
  139. lmcache/v1/distributed/l2_adapters/dax/core.py +52 -43
  140. lmcache/v1/distributed/l2_adapters/dax_l2_adapter.py +39 -11
  141. lmcache/v1/distributed/l2_adapters/factory.py +1 -1
  142. lmcache/v1/distributed/l2_adapters/fault_inject_l2_adapter.py +1 -1
  143. lmcache/v1/distributed/l2_adapters/fs_l2_adapter.py +1 -1
  144. lmcache/v1/distributed/l2_adapters/fs_native_l2_adapter.py +1 -1
  145. lmcache/v1/distributed/l2_adapters/hf3fs_l2_adapter.py +1 -1
  146. lmcache/v1/distributed/l2_adapters/hfbucket_l2_adapter.py +1 -1
  147. lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py +1 -1
  148. lmcache/v1/distributed/l2_adapters/mooncake_store_l2_adapter.py +1 -1
  149. lmcache/v1/distributed/l2_adapters/native_connector_l2_adapter.py +1 -1
  150. lmcache/v1/distributed/l2_adapters/native_plugin_l2_adapter.py +1 -1
  151. lmcache/v1/distributed/l2_adapters/nixl_native_l2_adapter.py +1 -1
  152. lmcache/v1/distributed/l2_adapters/nixl_store_agents/file_dynamic_nixl_store_agent.py +1 -1
  153. lmcache/v1/distributed/l2_adapters/nixl_store_dynamic_l2_adapter.py +1 -1
  154. lmcache/v1/distributed/l2_adapters/nixl_store_l2_adapter.py +1 -1
  155. lmcache/v1/distributed/l2_adapters/p2p_l2_adapter.py +195 -58
  156. lmcache/v1/distributed/l2_adapters/raw_block/core.py +201 -50
  157. lmcache/v1/distributed/l2_adapters/raw_block/io_engine.py +40 -2
  158. lmcache/v1/distributed/l2_adapters/raw_block_l2_adapter.py +19 -2
  159. lmcache/v1/distributed/l2_adapters/resp_l2_adapter.py +1 -1
  160. lmcache/v1/distributed/l2_adapters/s3_l2_adapter.py +1 -1
  161. lmcache/v1/distributed/l2_adapters/sagemaker_hyperpod_client.py +1 -1
  162. lmcache/v1/distributed/l2_adapters/sagemaker_hyperpod_l2_adapter.py +1 -1
  163. lmcache/v1/distributed/l2_adapters/serde_wrapper.py +1 -1
  164. lmcache/v1/distributed/l2_adapters/valkey/blob_tcp_worker_pool.py +1 -1
  165. lmcache/v1/distributed/l2_adapters/valkey/rdma_worker_pool.py +1 -1
  166. lmcache/v1/distributed/l2_adapters/valkey/worker_pool.py +1 -1
  167. lmcache/v1/distributed/l2_adapters/valkey_l2_adapter.py +1 -1
  168. lmcache/v1/distributed/memory_manager/devdax_l1_memory_manager.py +1 -1
  169. lmcache/v1/distributed/memory_manager/gds_l1_memory_manager.py +2 -2
  170. lmcache/v1/distributed/memory_manager/l1_memory_manager.py +1 -1
  171. lmcache/v1/distributed/memory_manager/shared_devdax_region.py +2 -1
  172. lmcache/v1/distributed/p2p.py +3 -3
  173. lmcache/v1/distributed/serde/aesgcm.py +1 -1
  174. lmcache/v1/distributed/serde/async_processor.py +1 -1
  175. lmcache/v1/distributed/serde/factory.py +1 -1
  176. lmcache/v1/distributed/storage_controllers/eviction_controller.py +1 -1
  177. lmcache/v1/distributed/storage_controllers/prefetch_controller.py +52 -21
  178. lmcache/v1/distributed/storage_controllers/prefetch_policy.py +1 -1
  179. lmcache/v1/distributed/storage_controllers/store_controller.py +1 -1
  180. lmcache/v1/distributed/storage_manager.py +34 -19
  181. lmcache/v1/distributed/transfer_channel/factory.py +1 -1
  182. lmcache/v1/distributed/transfer_channel/impl/mooncake_te_impl.py +1 -1
  183. lmcache/v1/distributed/transfer_channel/impl/nixl_impl.py +1 -1
  184. lmcache/v1/distributed/utils.py +457 -0
  185. lmcache/v1/gpu_connector/gds_backends/phx.py +1 -1
  186. lmcache/v1/gpu_connector/gds_backends/ugds.py +1 -1
  187. lmcache/v1/gpu_connector/gds_context.py +12 -1
  188. lmcache/v1/gpu_connector/gpu_ops.py +1 -1
  189. lmcache/v1/memory_allocators/ad_hoc_memory_allocator.py +1 -1
  190. lmcache/v1/memory_allocators/buffer_allocator.py +1 -1
  191. lmcache/v1/memory_allocators/devdax_memory_allocator.py +2 -6
  192. lmcache/v1/memory_allocators/gpu_memory_allocator.py +1 -1
  193. lmcache/v1/memory_allocators/lazy_memory_allocator.py +1 -1
  194. lmcache/v1/memory_allocators/mixed_memory_allocator.py +1 -1
  195. lmcache/v1/memory_allocators/paged_tensor_memory_allocator.py +1 -1
  196. lmcache/v1/memory_allocators/pin_memory_allocator.py +1 -1
  197. lmcache/v1/memory_allocators/tensor_memory_allocator.py +1 -1
  198. lmcache/v1/memory_management.py +9 -500
  199. lmcache/v1/memory_orchestrator/__init__.py +1 -1
  200. lmcache/v1/memory_orchestrator/client.py +1 -1
  201. lmcache/v1/memory_orchestrator/pooling.py +354 -0
  202. lmcache/v1/memory_orchestrator/server.py +1 -1
  203. lmcache/v1/memory_orchestrator/service.py +1 -1
  204. lmcache/v1/memory_orchestrator/state.py +1 -1
  205. lmcache/v1/mp_coordinator/app.py +7 -2
  206. lmcache/v1/mp_coordinator/background_loops.py +1 -1
  207. lmcache/v1/mp_coordinator/blend_client.py +1 -1
  208. lmcache/v1/mp_coordinator/blend_index.py +1 -1
  209. lmcache/v1/mp_coordinator/cache_events.py +1 -1
  210. lmcache/v1/mp_coordinator/config.py +17 -1
  211. lmcache/v1/mp_coordinator/controllers/__init__.py +1 -1
  212. lmcache/v1/mp_coordinator/controllers/eviction_controller.py +39 -22
  213. lmcache/v1/mp_coordinator/controllers/eviction_http_api.py +53 -42
  214. lmcache/v1/mp_coordinator/controllers/prefetch_manager.py +7 -22
  215. lmcache/v1/mp_coordinator/events_replay.py +1 -1
  216. lmcache/v1/mp_coordinator/http_apis/cache_api.py +28 -8
  217. lmcache/v1/mp_coordinator/http_apis/instances_api.py +1 -1
  218. lmcache/v1/mp_coordinator/http_auth.py +26 -12
  219. lmcache/v1/mp_coordinator/ingest/event_broadcaster.py +1 -1
  220. lmcache/v1/mp_coordinator/ingest/event_gate.py +1 -1
  221. lmcache/v1/mp_coordinator/ingest/kafka_event_source.py +1 -1
  222. lmcache/v1/mp_coordinator/persistence/checkpoint.py +1 -1
  223. lmcache/v1/mp_coordinator/persistence/metadata.py +1 -1
  224. lmcache/v1/mp_coordinator/persistence/store.py +1 -1
  225. lmcache/v1/mp_coordinator/registrar.py +3 -3
  226. lmcache/v1/mp_coordinator/schemas.py +144 -101
  227. lmcache/v1/mp_coordinator/views/__init__.py +1 -1
  228. lmcache/v1/mp_coordinator/views/instance_registry.py +2 -2
  229. lmcache/v1/mp_coordinator/views/key_directory.py +55 -1
  230. lmcache/v1/mp_coordinator/views/server_config.py +1 -1
  231. lmcache/v1/mp_coordinator/views/usage_manager.py +1 -1
  232. lmcache/v1/mp_observability/README.md +2 -2
  233. lmcache/v1/mp_observability/errors.py +1 -1
  234. lmcache/v1/mp_observability/event_bus.py +1 -1
  235. lmcache/v1/mp_observability/gc_monitor.py +1 -1
  236. lmcache/v1/mp_observability/otel_init.py +1 -1
  237. lmcache/v1/mp_observability/subscribers/logging/cb_server.py +1 -1
  238. lmcache/v1/mp_observability/subscribers/logging/extra_stats.py +1 -1
  239. lmcache/v1/mp_observability/subscribers/logging/l1.py +1 -1
  240. lmcache/v1/mp_observability/subscribers/logging/l2.py +1 -1
  241. lmcache/v1/mp_observability/subscribers/logging/lookup_hash.py +1 -1
  242. lmcache/v1/mp_observability/subscribers/logging/mp_server.py +1 -1
  243. lmcache/v1/mp_observability/subscribers/logging/sm.py +1 -1
  244. lmcache/v1/mp_observability/subscribers/logging/timeout.py +1 -1
  245. lmcache/v1/mp_observability/subscribers/metrics/cb_server.py +1 -1
  246. lmcache/v1/mp_observability/subscribers/metrics/lookup.py +9 -7
  247. lmcache/v1/mp_observability/subscribers/metrics/phase_timing.py +1 -1
  248. lmcache/v1/mp_observability/subscribers/tracing/cb_server.py +1 -1
  249. lmcache/v1/mp_observability/subscribers/tracing/mp_server.py +1 -1
  250. lmcache/v1/mp_observability/subscribers/tracing/span_registry.py +1 -1
  251. lmcache/v1/mp_observability/subscribers/tracing/timeout.py +1 -1
  252. lmcache/v1/mp_observability/subscribers/tracing/transfer_phase.py +2 -2
  253. lmcache/v1/mp_observability/trace/lifecycle.py +1 -1
  254. lmcache/v1/mp_observability/trace/reader.py +1 -1
  255. lmcache/v1/mp_observability/trace/recorder.py +1 -1
  256. lmcache/v1/multiprocess/affinity_pool.py +1 -40
  257. lmcache/v1/multiprocess/cache_control/key_resolver.py +163 -21
  258. lmcache/v1/multiprocess/cache_control/prefetch_service.py +116 -30
  259. lmcache/v1/multiprocess/config.py +7 -23
  260. lmcache/v1/multiprocess/engine_context.py +83 -7
  261. lmcache/v1/multiprocess/engine_module.py +1 -1
  262. lmcache/v1/multiprocess/ext_server_module.py +13 -2
  263. lmcache/v1/multiprocess/http_api_registry.py +1 -1
  264. lmcache/v1/multiprocess/http_apis/cache_api.py +15 -6
  265. lmcache/v1/multiprocess/http_apis/common/periodic_thread_api.py +1 -1
  266. lmcache/v1/multiprocess/http_apis/common/run_script_api.py +1 -1
  267. lmcache/v1/multiprocess/http_apis/info_api.py +1 -1
  268. lmcache/v1/multiprocess/http_apis/l1_reconfigure_api.py +1 -1
  269. lmcache/v1/multiprocess/http_apis/schemas.py +31 -6
  270. lmcache/v1/multiprocess/http_auth.py +3 -3
  271. lmcache/v1/multiprocess/http_reconfigure.py +66 -0
  272. lmcache/v1/multiprocess/http_server.py +3 -1
  273. lmcache/v1/multiprocess/kv_load_policy.py +1 -1
  274. lmcache/v1/multiprocess/modules/blend/lookup.py +16 -3
  275. lmcache/v1/multiprocess/modules/blend/matcher.py +1 -1
  276. lmcache/v1/multiprocess/modules/blend/module.py +1 -1
  277. lmcache/v1/multiprocess/modules/blend/read_set.py +25 -0
  278. lmcache/v1/multiprocess/modules/blend/registration.py +1 -1
  279. lmcache/v1/multiprocess/modules/blend/retrieve.py +27 -6
  280. lmcache/v1/multiprocess/modules/blend/store.py +26 -7
  281. lmcache/v1/multiprocess/modules/engine_driven_transfer.py +244 -60
  282. lmcache/v1/multiprocess/modules/lmcache_driven_transfer.py +170 -113
  283. lmcache/v1/multiprocess/modules/lookup.py +133 -28
  284. lmcache/v1/multiprocess/modules/management.py +7 -7
  285. lmcache/v1/multiprocess/modules/p2p_controller.py +7 -7
  286. lmcache/v1/multiprocess/modules/server_transfer.py +76 -33
  287. lmcache/v1/multiprocess/mp_runtime_plugin_launcher.py +1 -1
  288. lmcache/v1/multiprocess/native_completion.py +2 -2
  289. lmcache/v1/multiprocess/object_group_transfer/direct_copy.py +1 -1
  290. lmcache/v1/multiprocess/object_group_transfer/staged.py +1 -1
  291. lmcache/v1/multiprocess/plugin_modules/qstore.py +59 -29
  292. lmcache/v1/multiprocess/server.py +12 -1
  293. lmcache/v1/multiprocess/session.py +37 -6
  294. lmcache/v1/multiprocess/transport/grpc_impl/aio_server.py +6 -2
  295. lmcache/v1/multiprocess/transport/grpc_impl/auth.py +2 -2
  296. lmcache/v1/multiprocess/transport/grpc_impl/native_server.py +7 -6
  297. lmcache/v1/multiprocess/transport/grpc_impl/server.py +6 -2
  298. lmcache/v1/multiprocess/transport/grpc_impl/server_base.py +2 -2
  299. lmcache/v1/multiprocess/transport/grpc_impl/server_builder.py +1 -1
  300. lmcache/v1/multiprocess/transport/zmq_impl/mq.py +44 -23
  301. lmcache/v1/multiprocess/warm_prefetch.py +1 -1
  302. lmcache/v1/platform/__init__.py +1 -1
  303. lmcache/v1/platform/_device_detect.py +2 -2
  304. lmcache/v1/platform/base/cache_context.py +32 -16
  305. lmcache/v1/platform/base/device_ops.py +4 -11
  306. lmcache/v1/platform/base/ipc_wire.py +21 -0
  307. lmcache/v1/platform/base/object_group_transfer.py +68 -0
  308. lmcache/v1/platform/cache_context.py +25 -3
  309. lmcache/v1/platform/devices/cpu/cache_context.py +12 -3
  310. lmcache/v1/platform/devices/cpu/shm.py +1 -1
  311. lmcache/v1/platform/devices/cpu/stub_cpu_device.py +1 -1
  312. lmcache/v1/platform/devices/cuda/cache_context.py +36 -16
  313. lmcache/v1/platform/devices/cuda/device_ops.py +1 -1
  314. lmcache/v1/platform/devices/cuda/ipc_wrapper.py +1 -1
  315. lmcache/v1/platform/devices/cuda/pin_memory.py +1 -1
  316. lmcache/v1/platform/devices/cuda/timeline_semaphore_event_ipc.py +1 -1
  317. lmcache/v1/platform/devices/gcu/__init__.py +124 -0
  318. lmcache/v1/platform/devices/gcu/cache_context.py +542 -0
  319. lmcache/v1/platform/devices/gcu/device_ops.py +427 -0
  320. lmcache/v1/platform/devices/gcu/event_ipc.py +61 -0
  321. lmcache/v1/platform/devices/gcu/ipc_wrapper.py +212 -0
  322. lmcache/v1/platform/devices/gcu/pin_memory.py +167 -0
  323. lmcache/v1/platform/devices/mlu/__init__.py +1 -1
  324. lmcache/v1/platform/devices/mlu/device_ops.py +1 -1
  325. lmcache/v1/platform/devices/musa/cache_context.py +32 -19
  326. lmcache/v1/platform/devices/musa/device_ops.py +2 -2
  327. lmcache/v1/platform/devices/musa/pin_memory.py +1 -1
  328. lmcache/v1/platform/devices/neuron/__init__.py +1 -1
  329. lmcache/v1/platform/devices/neuron/device_ops.py +1 -1
  330. lmcache/v1/platform/devices/npu/cache_context.py +11 -3
  331. lmcache/v1/platform/devices/npu/event_ipc.py +1 -1
  332. lmcache/v1/platform/devices/npu/pin_memory.py +2 -2
  333. lmcache/v1/platform/devices/rbln/device_ops.py +2 -2
  334. lmcache/v1/platform/devices/rocm/pin_memory.py +1 -1
  335. lmcache/v1/platform/devices/xpu/__init__.py +1 -1
  336. lmcache/v1/platform/devices/xpu/device_ops.py +1 -1
  337. lmcache/v1/platform/devices/xpu/pin_memory.py +1 -1
  338. lmcache/v1/platform/fd_channel.py +1 -1
  339. lmcache/v1/platform/kv_wrap.py +1 -1
  340. lmcache/v1/platform/native_block_transfer.py +2 -2
  341. lmcache/v1/platform/torch_ops/mem_alloc.py +1 -1
  342. lmcache/v1/platform/torch_ops/mem_kernels.py +0 -100
  343. lmcache/v1/platform/torch_ops/mp_mem_kernels.py +1 -1
  344. lmcache/v1/plugin/runtime_plugin_launcher.py +1 -1
  345. lmcache/v1/rpc_utils.py +1 -1
  346. lmcache/v1/transport/auth.py +2 -2
  347. lmcache/v1/{client/transport → transport}/errors.py +5 -1
  348. lmcache/v1/transport/futures.py +1 -2
  349. lmcache/v1/transport/grpc/_proto_gen/common_pb2.pyi +12 -2
  350. lmcache/v1/{client/transport/grpc_impl → transport/grpc}/auth.py +1 -1
  351. lmcache/v1/transport/grpc/protos/common.proto +8 -0
  352. lmcache/v1/transport/grpc/protos/engine_driven_service.proto +10 -2
  353. lmcache/v1/transport/grpc/protos/lmcache_driven_service.proto +5 -1
  354. lmcache/v1/transport/grpc/protos/qstore_service.proto +15 -1
  355. lmcache/v1/transport/grpc/utils.py +1 -1
  356. lmcache/v1/transport/request_client.py +32 -5
  357. lmcache/v1/transport/zmq/__init__.py +4 -0
  358. lmcache/v1/utils/bloom_filter.py +1 -1
  359. lmcache/v1/utils/router_discovery.py +1 -1
  360. {lmcache_cli-0.5.9.dev0.dist-info → lmcache_cli-0.5.9rc2.dev0.dist-info}/METADATA +1 -1
  361. {lmcache_cli-0.5.9.dev0.dist-info → lmcache_cli-0.5.9rc2.dev0.dist-info}/RECORD +369 -357
  362. lmcache/integration/tensorrt_llm/tensorrt_adapter.py +0 -17
  363. lmcache/v1/exceptions/__init__.py +0 -16
  364. lmcache/v1/memory_allocators/host_memory_allocator.py +0 -135
  365. lmcache/v1/multiprocess/rocm_host_event_wait.py +0 -386
  366. /lmcache/{banner.py → v1/common/banner.py} +0 -0
  367. /lmcache/{security → v1/common/security}/api_key.py +0 -0
  368. /lmcache/{security → v1/common/security}/bearer.py +0 -0
  369. /lmcache/v1/{client/transfer_context → transport}/tensor_wire.py +0 -0
  370. {lmcache_cli-0.5.9.dev0.dist-info → lmcache_cli-0.5.9rc2.dev0.dist-info}/WHEEL +0 -0
  371. {lmcache_cli-0.5.9.dev0.dist-info → lmcache_cli-0.5.9rc2.dev0.dist-info}/entry_points.txt +0 -0
  372. {lmcache_cli-0.5.9.dev0.dist-info → lmcache_cli-0.5.9rc2.dev0.dist-info}/licenses/LICENSE +0 -0
  373. {lmcache_cli-0.5.9.dev0.dist-info → lmcache_cli-0.5.9rc2.dev0.dist-info}/top_level.txt +0 -0
lmcache/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  # SPDX-License-Identifier: Apache-2.0
2
2
 
3
3
  # First Party
4
- from lmcache.logging import init_logger
4
+ from lmcache.v1.common.logging import init_logger
5
5
 
6
6
  # --------------------------
7
7
  # Backend instance & Device detection
lmcache/_version.py CHANGED
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.5.9.dev0'
22
- __version_tuple__ = version_tuple = (0, 5, 9, 'dev0')
21
+ __version__ = version = '0.5.9rc2.dev0'
22
+ __version_tuple__ = version_tuple = (0, 5, 9, 'rc2', 'dev0')
23
23
 
24
- __commit_id__ = commit_id = 'g651617efc'
24
+ __commit_id__ = commit_id = 'g51428bcc2'
@@ -18,7 +18,7 @@ import argparse
18
18
 
19
19
  # First Party
20
20
  from lmcache.cli.commands.base import BaseCommand, CompositeCommand
21
- from lmcache.v1.utils.subclass_discovery import discover_subclasses
21
+ from lmcache.v1.common.subclass_discovery import discover_subclasses
22
22
 
23
23
  ALL_COMMANDS: list[BaseCommand]
24
24
 
@@ -11,7 +11,7 @@ import argparse
11
11
  import sys
12
12
 
13
13
  # First Party
14
- from lmcache.logging import init_logger
14
+ from lmcache.v1.common.logging import init_logger
15
15
  from lmcache.v1.common.metrics import (
16
16
  FileHandler,
17
17
  Metrics,
@@ -305,7 +305,7 @@ class CompositeCommand(BaseCommand):
305
305
  """
306
306
  # Deferred import to avoid circular dependency
307
307
  # First Party
308
- from lmcache.v1.utils.subclass_discovery import discover_subclasses
308
+ from lmcache.v1.common.subclass_discovery import discover_subclasses
309
309
 
310
310
  package = self.__class__.__module__
311
311
 
@@ -43,7 +43,7 @@ from lmcache.cli.commands.bench.engine_bench.workloads import (
43
43
  validate_max_output_length_supported,
44
44
  )
45
45
  from lmcache.cli.commands.bench.engine_bench.workloads.base import BaseWorkload
46
- from lmcache.logging import init_logger
46
+ from lmcache.v1.common.logging import init_logger
47
47
 
48
48
  if TYPE_CHECKING:
49
49
  # First Party
@@ -19,7 +19,7 @@ except ModuleNotFoundError as exc:
19
19
  OpenAI = None # type: ignore[assignment]
20
20
 
21
21
  # First Party
22
- from lmcache.logging import init_logger
22
+ from lmcache.v1.common.logging import init_logger
23
23
 
24
24
  logger = init_logger(__name__)
25
25
 
@@ -33,7 +33,7 @@ import random
33
33
  from lmcache.cli.commands.bench.engine_bench.tokenizers import (
34
34
  build_single_token_pool,
35
35
  )
36
- from lmcache.logging import init_logger
36
+ from lmcache.v1.common.logging import init_logger
37
37
 
38
38
  logger = init_logger(__name__)
39
39
 
@@ -17,7 +17,7 @@ import json
17
17
  import os
18
18
 
19
19
  # First Party
20
- from lmcache.logging import init_logger
20
+ from lmcache.v1.common.logging import init_logger
21
21
 
22
22
  logger = init_logger(__name__)
23
23
 
@@ -8,7 +8,7 @@ import string
8
8
  import unicodedata
9
9
 
10
10
  # First Party
11
- from lmcache.logging import init_logger
11
+ from lmcache.v1.common.logging import init_logger
12
12
 
13
13
  logger = init_logger(__name__)
14
14
 
@@ -17,7 +17,7 @@ except ModuleNotFoundError as exc:
17
17
 
18
18
  # First Party
19
19
  from lmcache.cli.commands.bench.engine_bench.stats import RequestResult
20
- from lmcache.logging import init_logger
20
+ from lmcache.v1.common.logging import init_logger
21
21
 
22
22
  logger = init_logger(__name__)
23
23
 
@@ -11,7 +11,7 @@ import time
11
11
 
12
12
  # First Party
13
13
  from lmcache.cli.commands.bench.engine_bench.config import EngineBenchConfig
14
- from lmcache.logging import init_logger
14
+ from lmcache.v1.common.logging import init_logger
15
15
 
16
16
  logger = init_logger(__name__)
17
17
 
@@ -13,7 +13,7 @@ import random
13
13
  import re
14
14
 
15
15
  # First Party
16
- from lmcache.logging import init_logger
16
+ from lmcache.v1.common.logging import init_logger
17
17
 
18
18
  logger = init_logger(__name__)
19
19
 
@@ -53,7 +53,7 @@ from lmcache.cli.commands.bench.engine_bench.workloads.random_prefill import (
53
53
  RandomPrefillConfig,
54
54
  RandomPrefillWorkload,
55
55
  )
56
- from lmcache.logging import init_logger
56
+ from lmcache.v1.common.logging import init_logger
57
57
 
58
58
  __all__ = [
59
59
  "DEFAULT_DOC_ALIGN_TOKENS",
@@ -13,7 +13,7 @@ from lmcache.cli.commands.bench.engine_bench.config import WarmupPolicy
13
13
  from lmcache.cli.commands.bench.engine_bench.progress import ProgressMonitor
14
14
  from lmcache.cli.commands.bench.engine_bench.request_sender import RequestSender
15
15
  from lmcache.cli.commands.bench.engine_bench.stats import StatsCollector
16
- from lmcache.logging import init_logger
16
+ from lmcache.v1.common.logging import init_logger
17
17
 
18
18
  logger = init_logger(__name__)
19
19
 
@@ -112,7 +112,7 @@ from lmcache.cli.commands.bench.engine_bench.workloads.base import (
112
112
  BaseWorkload,
113
113
  MetricSection,
114
114
  )
115
- from lmcache.logging import init_logger
115
+ from lmcache.v1.common.logging import init_logger
116
116
 
117
117
  logger = init_logger(__name__)
118
118
 
@@ -43,7 +43,7 @@ from lmcache.cli.commands.bench.engine_bench.tokenizers import (
43
43
  try_load_tokenizer,
44
44
  )
45
45
  from lmcache.cli.commands.bench.engine_bench.workloads.base import BaseWorkload
46
- from lmcache.logging import init_logger
46
+ from lmcache.v1.common.logging import init_logger
47
47
 
48
48
  logger = init_logger(__name__)
49
49
 
@@ -13,7 +13,7 @@ from lmcache.cli.commands.bench.engine_bench.request_sender import (
13
13
  )
14
14
  from lmcache.cli.commands.bench.engine_bench.stats import StatsCollector
15
15
  from lmcache.cli.commands.bench.engine_bench.workloads.base import BaseWorkload
16
- from lmcache.logging import init_logger
16
+ from lmcache.v1.common.logging import init_logger
17
17
 
18
18
  logger = init_logger(__name__)
19
19
 
@@ -12,7 +12,7 @@ from lmcache.cli.commands.bench.engine_bench.request_sender import (
12
12
  )
13
13
  from lmcache.cli.commands.bench.engine_bench.stats import StatsCollector
14
14
  from lmcache.cli.commands.bench.engine_bench.workloads.base import BaseWorkload
15
- from lmcache.logging import init_logger
15
+ from lmcache.v1.common.logging import init_logger
16
16
 
17
17
  logger = init_logger(__name__)
18
18
 
@@ -135,7 +135,7 @@ from lmcache.cli.commands.bench.engine_bench.request_sender import RequestSender
135
135
  from lmcache.cli.commands.bench.engine_bench.stats import StatsCollector
136
136
  from lmcache.cli.commands.bench.engine_bench.tokenizers import try_load_tokenizer
137
137
  from lmcache.cli.commands.bench.engine_bench.workloads.base import BaseWorkload
138
- from lmcache.logging import init_logger
138
+ from lmcache.v1.common.logging import init_logger
139
139
 
140
140
  logger = init_logger(__name__)
141
141
 
@@ -48,7 +48,7 @@ from lmcache.cli.commands.bench.engine_bench.workloads.base import (
48
48
  BaseWorkload,
49
49
  MetricSection,
50
50
  )
51
- from lmcache.logging import init_logger
51
+ from lmcache.v1.common.logging import init_logger
52
52
 
53
53
  logger = init_logger(__name__)
54
54
 
@@ -12,7 +12,7 @@ from lmcache.cli.commands.bench.engine_bench.request_sender import (
12
12
  )
13
13
  from lmcache.cli.commands.bench.engine_bench.stats import StatsCollector
14
14
  from lmcache.cli.commands.bench.engine_bench.workloads.base import BaseWorkload
15
- from lmcache.logging import init_logger
15
+ from lmcache.v1.common.logging import init_logger
16
16
 
17
17
  logger = init_logger(__name__)
18
18
 
@@ -22,6 +22,7 @@ import time
22
22
  from lmcache.lmcache_native import Bitmap
23
23
  from lmcache.v1.distributed.api import MemoryLayoutDesc, ObjectKey
24
24
  from lmcache.v1.distributed.internal_api import L2StoreResult
25
+ from lmcache.v1.distributed.l2_adapters.base import L2AdapterInterface
25
26
  from lmcache.v1.memory_management import MemoryObj
26
27
 
27
28
  # Local
@@ -50,26 +51,28 @@ def _bitmap_count(bitmap: Bitmap | None) -> int:
50
51
 
51
52
 
52
53
  def _wait_store_finished(
53
- adapter, task_ids: list[int], timeout: float
54
+ adapter: L2AdapterInterface, task_ids: list[int], timeout: float
54
55
  ) -> dict[int, L2StoreResult]:
55
56
  """Wait for all store tasks to finish.
56
57
 
57
58
  Returns the accumulated ``{task_id: L2StoreResult}`` dict.
58
59
  ``pop_completed_store_tasks`` consumes the adapter's completion
59
60
  dict, so we must accumulate the results here for the caller to
60
- use. On timeout, returns whatever was harvested so far (possibly
61
+ use. Only the requested task IDs count: earlier timed-out rounds may
62
+ still complete. On timeout, returns whatever was harvested so far (possibly
61
63
  empty or partial); the caller can detect timeout by comparing
62
64
  ``len(returned_dict)`` against ``len(task_ids)``.
63
65
  """
64
- unfinished = len(task_ids)
66
+ pending = set(task_ids)
65
67
  efd = adapter.get_store_event_fd()
66
68
  completed: dict[int, L2StoreResult] = {}
67
- while unfinished > 0:
69
+ while pending:
68
70
  if not wait_eventfd(efd, timeout=timeout):
69
71
  return completed
70
72
  batch = adapter.pop_completed_store_tasks()
71
- completed.update(batch)
72
- unfinished -= len(batch)
73
+ for task_id in pending.intersection(batch):
74
+ completed[task_id] = batch[task_id]
75
+ pending.remove(task_id)
73
76
  return completed
74
77
 
75
78
 
@@ -44,7 +44,7 @@ from lmcache.cli.commands.bench.quality_bench.core.verdict import (
44
44
  decide,
45
45
  lexical_scores,
46
46
  )
47
- from lmcache.logging import init_logger
47
+ from lmcache.v1.common.logging import init_logger
48
48
 
49
49
  logger = init_logger(__name__)
50
50
 
@@ -14,7 +14,7 @@ import time
14
14
  import urllib.request
15
15
 
16
16
  # First Party
17
- from lmcache.logging import init_logger
17
+ from lmcache.v1.common.logging import init_logger
18
18
 
19
19
  logger = init_logger(__name__)
20
20
 
@@ -30,7 +30,7 @@ from lmcache.cli.commands.bench.quality_bench.core.config import JudgeSettings
30
30
  from lmcache.cli.commands.bench.quality_bench.core.plan import QualityPlan
31
31
  from lmcache.cli.commands.bench.quality_bench.core.runner import ArmRun
32
32
  from lmcache.cli.commands.bench.quality_bench.core.verdict import ScoreTable
33
- from lmcache.logging import init_logger
33
+ from lmcache.v1.common.logging import init_logger
34
34
 
35
35
  logger = init_logger(__name__)
36
36
 
@@ -33,7 +33,7 @@ from lmcache.cli.commands.bench.quality_bench.core.verdict import (
33
33
  QualityVerdict,
34
34
  ReuseReport,
35
35
  )
36
- from lmcache.logging import init_logger
36
+ from lmcache.v1.common.logging import init_logger
37
37
 
38
38
  logger = init_logger(__name__)
39
39
 
@@ -37,7 +37,7 @@ from lmcache.cli.commands.bench.quality_bench.core.blend_counters import (
37
37
  from lmcache.cli.commands.bench.quality_bench.core.config import ArmRole
38
38
  from lmcache.cli.commands.bench.quality_bench.core.plan import QualityPlan
39
39
  from lmcache.cli.commands.bench.quality_bench.core.runner import ArmAnswer, ArmRun
40
- from lmcache.logging import init_logger
40
+ from lmcache.v1.common.logging import init_logger
41
41
 
42
42
  logger = init_logger(__name__)
43
43
 
@@ -130,7 +130,7 @@ def lmcache_version() -> str:
130
130
  """Return the installed lmcache version, with its commit when known.
131
131
 
132
132
  Read from the build-generated ``lmcache._version`` rather than
133
- ``lmcache.utils``, which imports torch (absent from ``lmcache-cli``).
133
+ ``lmcache.v1.distributed.utils``, which imports torch (absent from ``lmcache-cli``).
134
134
  """
135
135
  try:
136
136
  # First Party
@@ -64,7 +64,7 @@ from lmcache.cli.commands.bench.quality_bench.core.runner import (
64
64
  )
65
65
  from lmcache.cli.commands.bench.quality_bench.core.task import check_task
66
66
  from lmcache.cli.commands.bench.quality_bench.core.verdict import run_problems
67
- from lmcache.logging import init_logger
67
+ from lmcache.v1.common.logging import init_logger
68
68
 
69
69
  logger = init_logger(__name__)
70
70
 
@@ -18,7 +18,7 @@ from lmcache.cli.commands.bench.quality_bench.core.blend_counters import (
18
18
  )
19
19
  from lmcache.cli.commands.bench.quality_bench.core.config import ArmRole
20
20
  from lmcache.cli.commands.bench.quality_bench.core.plan import QualityPlan
21
- from lmcache.logging import init_logger
21
+ from lmcache.v1.common.logging import init_logger
22
22
 
23
23
  logger = init_logger(__name__)
24
24
 
@@ -26,8 +26,8 @@ def add_server_arguments(parser: argparse.ArgumentParser) -> None:
26
26
 
27
27
  parser.add_argument(
28
28
  "--rpc-url",
29
- default="tcp://localhost:5555",
30
- help=("MP request endpoint (default: tcp://localhost:5555)"),
29
+ default="grpc://localhost:5555",
30
+ help=("MP request endpoint (default: grpc://localhost:5555)"),
31
31
  )
32
32
  parser.add_argument(
33
33
  "--mode",
@@ -135,7 +135,7 @@ def add_server_arguments(parser: argparse.ArgumentParser) -> None:
135
135
  "'(1,1024,16,1,128):float16:4;"
136
136
  "(2,1024,16,8,128):float16:28'. "
137
137
  "All groups must share the same NB and BS. "
138
- "See lmcache.v1.kv_layer_groups.parse_kvcache_shape_spec "
138
+ "See lmcache.v1.common.kv_layer_groups.parse_kvcache_shape_spec "
139
139
  "for the authoritative parser. Default: '%s'" % _DEFAULT_SHAPE_SPEC
140
140
  ),
141
141
  )
@@ -11,7 +11,7 @@ import torch
11
11
  # First Party
12
12
  from lmcache import torch_dev, torch_device_type
13
13
  from lmcache.v1.common.group_view import EngineGroupInfo
14
- from lmcache.v1.kv_layer_groups import KVLayerGroupInfo
14
+ from lmcache.v1.common.kv_layer_groups import KVLayerGroupInfo
15
15
  from lmcache.v1.platform import synchronize_device
16
16
 
17
17
 
@@ -43,18 +43,18 @@ from lmcache.cli.commands.bench.server_bench.helpers import (
43
43
  _send_lookup,
44
44
  _wait_for_result,
45
45
  )
46
- from lmcache.utils import EngineType
47
46
  from lmcache.v1.client.transport.factory import RequestClientFactory
48
47
  from lmcache.v1.client.worker_transfer import (
49
48
  EngineDrivenTransferContext,
50
49
  create_transfer_context,
51
50
  )
52
- from lmcache.v1.common.utils import LayoutHints
53
- from lmcache.v1.kv_layer_groups import (
51
+ from lmcache.v1.common.custom_types import EngineType
52
+ from lmcache.v1.common.kv_layer_groups import (
54
53
  DTYPE_MAP,
55
54
  format_kvcache_shape_spec,
56
55
  parse_kvcache_shape_spec,
57
56
  )
57
+ from lmcache.v1.common.utils import LayoutHints
58
58
 
59
59
  if TYPE_CHECKING:
60
60
  # First Party
@@ -985,6 +985,7 @@ class ServerBenchClient:
985
985
  layout_hints=layout_hints,
986
986
  engine_group_infos=buffers.engine_group_infos,
987
987
  engine_type=EngineType.VLLM,
988
+ lmcache_chunk_tokens=self._chunk_size,
988
989
  )
989
990
  except TimeoutError:
990
991
  raise RuntimeError(
@@ -17,15 +17,15 @@ The command exercises the full store / retrieve data path:
17
17
  Usage examples::
18
18
 
19
19
  # GPU mode: real CUDA tensors + IPC
20
- lmcache bench server --rpc-url tcp://localhost:5555 \\
20
+ lmcache bench server --rpc-url grpc://localhost:5555 \\
21
21
  --num-tokens 512 --start 0 --end 3
22
22
 
23
23
  # Custom KV cache shape (multi-group spec)
24
- lmcache bench server --rpc-url tcp://localhost:5555 \\
24
+ lmcache bench server --rpc-url grpc://localhost:5555 \\
25
25
  --kvcache-shape-spec '(2,32,1024,8,128):float16:32'
26
26
 
27
27
  # Run forever starting from sequence 0
28
- lmcache bench server --rpc-url tcp://localhost:5555
28
+ lmcache bench server --rpc-url grpc://localhost:5555
29
29
  """
30
30
 
31
31
  # Future
@@ -12,8 +12,8 @@ import json
12
12
 
13
13
  # First Party
14
14
  from lmcache.cli.commands.base import BaseCommand
15
- from lmcache.logging import init_logger
16
- from lmcache.security.api_key import add_api_key_args
15
+ from lmcache.v1.common.logging import init_logger
16
+ from lmcache.v1.common.security.api_key import add_api_key_args
17
17
 
18
18
  logger = init_logger(__name__)
19
19
 
@@ -249,6 +249,30 @@ class CoordinatorCommand(BaseCommand):
249
249
  # unset flag leaves the coordinator open; supplying a key closes every
250
250
  # route except /healthz.
251
251
  add_api_key_args(parser)
252
+ parser.add_argument(
253
+ "--public-endpoint",
254
+ dest="public_endpoint",
255
+ action="append",
256
+ default=None,
257
+ metavar="PATH",
258
+ help=(
259
+ "Serve PATH without credentials when API-key authentication is "
260
+ "on. Repeat for several paths. Replaces the default list, which "
261
+ "is /healthz alone, instead of extending it; /metrics and every "
262
+ "other path require the key. Repeat this flag for each path you "
263
+ "want public. Matching is exact."
264
+ ),
265
+ )
266
+ parser.add_argument(
267
+ "--no-public-endpoints",
268
+ dest="no_public_endpoints",
269
+ action="store_true",
270
+ default=False,
271
+ help=(
272
+ "Require a valid API key for every HTTP path, including "
273
+ "/healthz. Cannot be combined with --public-endpoint."
274
+ ),
275
+ )
252
276
 
253
277
  def execute(self, args: argparse.Namespace) -> None:
254
278
  """Build the coordinator config and serve the app with uvicorn.
@@ -326,6 +350,9 @@ class CoordinatorCommand(BaseCommand):
326
350
  fields["event_source_config"] = KafkaCacheEventSourceConfig(**kafka_fields)
327
351
  if args.disable_metrics is not None:
328
352
  fields["metrics_enabled"] = not args.disable_metrics
353
+ public_endpoints = _resolve_public_endpoints(args)
354
+ if public_endpoints is not None:
355
+ fields["public_endpoints"] = public_endpoints
329
356
  extra_config = _parse_extra_config(args.extra_config)
330
357
  if extra_config is not None:
331
358
  fields["extra_config"] = extra_config
@@ -346,6 +373,32 @@ class CoordinatorCommand(BaseCommand):
346
373
  )
347
374
 
348
375
 
376
+ def _resolve_public_endpoints(args: argparse.Namespace) -> tuple[str, ...] | None:
377
+ """Resolve the credential-free coordinator paths.
378
+
379
+ Args:
380
+ args: Parsed coordinator arguments.
381
+
382
+ Returns:
383
+ ``None`` when neither flag is set, so the config default (``/healthz``
384
+ and ``/metrics``) applies; an empty tuple for
385
+ ``--no-public-endpoints``; otherwise the given paths in order.
386
+
387
+ Raises:
388
+ ValueError: If both flags are used, or a path is not absolute.
389
+ """
390
+ paths = getattr(args, "public_endpoint", None) or []
391
+ if getattr(args, "no_public_endpoints", False):
392
+ if paths:
393
+ raise ValueError(
394
+ "--no-public-endpoints cannot be combined with --public-endpoint"
395
+ )
396
+ return ()
397
+ if not paths:
398
+ return None
399
+ return tuple(paths)
400
+
401
+
349
402
  def _parse_extra_config(raw: str | None) -> dict[str, object] | None:
350
403
  """Parse ``--extra-config``.
351
404
 
@@ -15,7 +15,7 @@ import urllib.request
15
15
 
16
16
  # First Party
17
17
  from lmcache.cli.commands.base import BaseCommand
18
- from lmcache.logging import init_logger
18
+ from lmcache.v1.common.logging import init_logger
19
19
 
20
20
  logger = init_logger(__name__)
21
21
 
@@ -7,7 +7,7 @@ import sys
7
7
 
8
8
  # First Party
9
9
  from lmcache.cli.commands.base import BaseCommand
10
- from lmcache.logging import init_logger
10
+ from lmcache.v1.common.logging import init_logger
11
11
 
12
12
  logger = init_logger(__name__)
13
13
 
@@ -28,7 +28,7 @@ import urllib.request
28
28
  from lmcache.cli.commands.describe import fmt_bytes
29
29
  from lmcache.cli.commands.quota._helpers import escape_salt
30
30
  from lmcache.cli.http import normalize_url as normalize_url
31
- from lmcache.logging import init_logger
31
+ from lmcache.v1.common.logging import init_logger
32
32
  from lmcache.v1.common.metrics import Metrics
33
33
 
34
34
  logger = init_logger(__name__)
@@ -13,7 +13,7 @@ from lmcache.cli.commands.query._coordinator import (
13
13
  get_text,
14
14
  normalize_url,
15
15
  )
16
- from lmcache.logging import init_logger
16
+ from lmcache.v1.common.logging import init_logger
17
17
 
18
18
  logger = init_logger(__name__)
19
19
 
@@ -10,7 +10,7 @@ import urllib.request
10
10
 
11
11
  # First Party
12
12
  from lmcache.cli.http import normalize_url as normalize_url
13
- from lmcache.logging import init_logger
13
+ from lmcache.v1.common.logging import init_logger
14
14
 
15
15
  logger = init_logger(__name__)
16
16
 
@@ -6,7 +6,7 @@ import argparse
6
6
 
7
7
  # First Party
8
8
  from lmcache.cli.commands.base import BaseCommand
9
- from lmcache.logging import init_logger
9
+ from lmcache.v1.common.logging import init_logger
10
10
 
11
11
  logger = init_logger(__name__)
12
12
 
@@ -22,7 +22,7 @@ from dataclasses import dataclass, field
22
22
  from typing import Any, Callable
23
23
 
24
24
  # First Party
25
- from lmcache.logging import init_logger
25
+ from lmcache.v1.common.logging import init_logger
26
26
  from lmcache.v1.distributed.api import ObjectKey
27
27
  from lmcache.v1.distributed.storage_manager import StorageManager, l1_owners_of
28
28
 
@@ -51,7 +51,7 @@ from lmcache.cli.commands.trace._dispatch import (
51
51
  build_default_dispatcher,
52
52
  )
53
53
  from lmcache.cli.commands.trace._stats import ReplayStatsCollector
54
- from lmcache.logging import init_logger
54
+ from lmcache.v1.common.logging import init_logger
55
55
  from lmcache.v1.distributed.config import StorageManagerConfig
56
56
  from lmcache.v1.distributed.storage_manager import StorageManager
57
57
  from lmcache.v1.mp_observability.config import (
@@ -27,7 +27,7 @@ import statistics
27
27
  import threading
28
28
 
29
29
  # First Party
30
- from lmcache.logging import init_logger
30
+ from lmcache.v1.common.logging import init_logger
31
31
 
32
32
  logger = init_logger(__name__)
33
33
 
@@ -13,7 +13,7 @@ import sys
13
13
 
14
14
  # First Party
15
15
  from lmcache.cli.commands.base import BaseCommand
16
- from lmcache.logging import init_logger
16
+ from lmcache.v1.common.logging import init_logger
17
17
  from lmcache.v1.common.metrics import Metrics, StreamHandler, get_formatter
18
18
 
19
19
  logger = init_logger(__name__)
@@ -12,7 +12,7 @@ import sys
12
12
 
13
13
  # First Party
14
14
  from lmcache.cli.commands.base import BaseCommand
15
- from lmcache.logging import init_logger
15
+ from lmcache.v1.common.logging import init_logger
16
16
  from lmcache.v1.common.metrics import Metrics, StreamHandler, get_formatter
17
17
 
18
18
  logger = init_logger(__name__)
lmcache/cli/main.py CHANGED
@@ -14,9 +14,9 @@ import argparse
14
14
  import sys
15
15
 
16
16
  # First Party
17
- from lmcache.banner import print_banner_once
18
17
  from lmcache.cli.commands import register_commands
19
- from lmcache.logging import init_logger
18
+ from lmcache.v1.common.banner import print_banner_once
19
+ from lmcache.v1.common.logging import init_logger
20
20
 
21
21
  logger = init_logger(__name__)
22
22