///
import type { ContextTimed } from '@matrixai/contexts';
import type { Capability, CapabilityList, ObjectId, ObjectIdList, Reference, RequestType } from './types.js';
import type { EncryptedFS } from 'encryptedfs';
declare const PACK_CHUNK_SIZE: number;
declare const HEAD_REFERENCE = "HEAD";
declare const REFERENCES_STRING = "refs/heads/";
declare const SIDE_BAND_64_CAPABILITY = "side-band-64k";
declare const AGENT_CAPABILITY = "agent=git/isomorphic-git@1.8.1";
declare const SPACE_STRING = " ";
declare const CHANNEL_DATA = 1;
declare const CHANNEL_PROGRESS = 2;
declare const CHANNEL_ERROR = 3;
declare const BUFFER_FORMAT = "utf-8";
declare const REFERENCE_DISCOVERY_HEADER: Buffer;
declare const NULL_BUFFER: Buffer;
declare const LINE_FEED_BUFFER: Buffer;
declare const ZERO_ID_BUFFER: Buffer;
declare const EMPTY_LIST_CAPABILITIES_BUFFER: Buffer;
declare const SPACE_BUFFER: Buffer;
declare const FLUSH_PACKET_BUFFER: Buffer;
declare const NAK_BUFFER: Buffer;
declare const DUMMY_PROGRESS_BUFFER: Buffer;
/**
* This will generate references and the objects they point to as a tuple.
* `HEAD` is always yielded first along with all branches.
*/
declare function listReferencesGenerator({ efs, dir, gitDir, }: {
efs: EncryptedFS;
dir: string;
gitDir: string;
}, ctx: ContextTimed): AsyncGenerator<[Reference, ObjectId], void, void>;
/**
* Reads the provided reference and formats it as a `symref` capability.
* This capability is used to indicate to the client where a certain ref points to if it doesn't point directly to an
* object. For now only used to indicate what `HEAD` points to.
*/
declare function referenceCapability({ efs, dir, gitDir, reference, }: {
efs: EncryptedFS;
dir: string;
gitDir: string;
reference: Reference;
}): Promise;
/**
* Preforms a walk of the git data structure, listing all objects found by the walk.
* This starts from all the objects in the `wants` list, walking across all dependent objects while skipping any
* objects in the `haves` list. This results in a complete list of objects that the `haves` require.
*
* Used by `generatePackRequest` to determine which objects are required in the `packFile`.
* The walk is preformed recursively and concurrently using promises.
* Inspecting the git data structure objects is done using `isomorphic-git`.
*/
declare function listObjects({ efs, dir, gitDir, wants, haves, }: {
efs: EncryptedFS;
dir: string;
gitDir: string;
wants: ObjectIdList;
haves: ObjectIdList;
}, ctx: ContextTimed): Promise;
/**
* Walks the filesystem to list out all git objects in the objects directory
*/
declare function listObjectsAll({ fs, gitDir, }: {
fs: EncryptedFS;
gitDir: string;
}, ctx: ContextTimed): Promise>;
/**
* Parses a want/has line from ref negotiation phase.
*/
declare function parseRequestLine(workingBuffer: Buffer): [RequestType, ObjectId, CapabilityList, Buffer] | undefined;
declare function isObjectId(objectId: unknown): objectId is ObjectId;
declare function assertObjectId(objectId: unknown): asserts objectId is ObjectId;
declare function isRequestType(requestType: unknown): requestType is RequestType;
declare function assertRequestType(requestType: unknown): asserts requestType is RequestType;
export { PACK_CHUNK_SIZE, HEAD_REFERENCE, REFERENCES_STRING, SIDE_BAND_64_CAPABILITY, AGENT_CAPABILITY, SPACE_STRING, CHANNEL_DATA, CHANNEL_PROGRESS, CHANNEL_ERROR, BUFFER_FORMAT, REFERENCE_DISCOVERY_HEADER, NULL_BUFFER, LINE_FEED_BUFFER, ZERO_ID_BUFFER, EMPTY_LIST_CAPABILITIES_BUFFER, SPACE_BUFFER, FLUSH_PACKET_BUFFER, NAK_BUFFER, DUMMY_PROGRESS_BUFFER, listReferencesGenerator, referenceCapability, listObjects, listObjectsAll, parseRequestLine, isObjectId, assertObjectId, isRequestType, assertRequestType, };