Rename content_hash/output_hash to cid throughout
Refactor to use IPFS CID as the primary content identifier: - Update database schema: content_hash -> cid, output_hash -> output_cid - Update all services, routers, and tasks to use cid terminology - Update HTML templates to display CID instead of hash - Update cache_manager parameter names - Update README documentation This completes the transition to CID-only content addressing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -27,7 +27,7 @@ class RecipeService:
|
||||
async def get_recipe(self, recipe_id: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get a recipe by ID (content hash)."""
|
||||
# Get from cache (content-addressed storage)
|
||||
path = self.cache.get_by_content_hash(recipe_id)
|
||||
path = self.cache.get_by_cid(recipe_id)
|
||||
if not path or not path.exists():
|
||||
return None
|
||||
|
||||
@@ -70,8 +70,8 @@ class RecipeService:
|
||||
if hasattr(self.cache, 'list_by_type'):
|
||||
items = self.cache.list_by_type('recipe')
|
||||
logger.info(f"Found {len(items)} recipes in cache")
|
||||
for content_hash in items:
|
||||
recipe = await self.get_recipe(content_hash)
|
||||
for cid in items:
|
||||
recipe = await self.get_recipe(cid)
|
||||
if recipe and not recipe.get("error"):
|
||||
owner = recipe.get("owner")
|
||||
# Filter by actor - L1 is per-user
|
||||
@@ -114,7 +114,7 @@ class RecipeService:
|
||||
|
||||
# Store in cache (content-addressed, auto-pins to IPFS)
|
||||
cached, ipfs_cid = self.cache.put(tmp_path, node_type="recipe", move=True)
|
||||
recipe_id = cached.content_hash
|
||||
recipe_id = cached.cid
|
||||
|
||||
return recipe_id, None
|
||||
|
||||
@@ -140,12 +140,12 @@ class RecipeService:
|
||||
|
||||
# Delete from cache
|
||||
try:
|
||||
if hasattr(self.cache, 'delete_by_content_hash'):
|
||||
success, msg = self.cache.delete_by_content_hash(recipe_id)
|
||||
if hasattr(self.cache, 'delete_by_cid'):
|
||||
success, msg = self.cache.delete_by_cid(recipe_id)
|
||||
if not success:
|
||||
return False, msg
|
||||
else:
|
||||
path = self.cache.get_by_content_hash(recipe_id)
|
||||
path = self.cache.get_by_cid(recipe_id)
|
||||
if path and path.exists():
|
||||
path.unlink()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user