pipe-protocol
Version:
A protocol for large scale Interplanetary Intertool Agent Context
91 lines • 2.26 kB
TypeScript
/**
* @file IPFS Client Implementation
* @version 1.0.0
* @status STABLE - DO NOT MODIFY WITHOUT TESTS
* @lastModified 2024-02-04
*
* IPFS client for interacting with IPFS nodes.
*
* IMPORTANT:
* - All modifications must maintain test coverage
* - Handle network errors gracefully
* - Maintain data consistency
* - Respect scope and pinning settings
*
* Functionality:
* - Store data in IPFS with configurable options
* - Retrieve data from IPFS
* - Pin management
* - Scope management (public/private)
* - Mock implementation for testing
*/
export interface IPFSClientConfig {
endpoint: string;
timeout: number;
scope: 'public' | 'private';
pin: boolean;
}
export interface IPFSStoreOptions {
pin?: boolean;
scope?: 'private' | 'public';
}
export declare class IPFSClient {
private config;
private storedData;
private pinnedCids;
constructor(config: IPFSClientConfig);
/**
* Store data in IPFS
*/
store(data: unknown, options?: {
pin?: boolean;
scope?: 'public' | 'private';
}): Promise<string>;
/**
* Fetch data from IPFS
*/
fetch(cid: string, scope: string): Promise<unknown | null>;
/**
* Pin data in IPFS
*/
pin(cid: string, scope: string): Promise<void>;
/**
* Unpin data from IPFS
*/
unpin(cid: string, scope: string): Promise<void>;
/**
* Get pinned CIDs for a scope
*/
getPinnedCids(scope: string): Promise<string[]>;
/**
* Get node status
*/
getStatus(): {
localNode: boolean;
publicNode: boolean;
};
/**
* Get node info for a scope
*/
getNodeInfo(scope: string): Promise<any>;
/**
* Get storage metrics for a scope
*/
getStorageMetrics(scope: string): Promise<{
totalSize: number;
numObjects: number;
}>;
/**
* Get configuration for a scope
*/
getConfiguration(scope: string): Promise<any>;
/**
* Replicate data from one scope to another
*/
replicate(cid: string, fromScope: string, toScope: string): Promise<string>;
/**
* Stop the client and cleanup resources
*/
stop(): Promise<void>;
}
//# sourceMappingURL=ipfsClient.d.ts.map