-- -- Warning: AUTOGENERATED DOCS. -- --- Class "ODB". -- module("ODB") --- Create a new ODB object. -- --

Calls git_odb_new:

Before the ODB can be used for read/writing, a custom database -- backend must be manually added using `git_odb_add_backend()` -- @return ODB or nil on error. -- @return Error string. -- @name ODB.new function ODB.new() end --- Create a new ODB object. -- --

Calls git_odb_open:

- git_odb_backend_loose: read and write loose object files -- from disk, assuming `objects_dir` as the Objects folder

- git_odb_backend_pack: read objects from packfiles, -- assuming `objects_dir` as the Objects folder which -- contains a 'pack/' folder with the corresponding data -- @param object_dir Must be of type string. -- @return ODB or nil on error. -- @return Error string. -- @name ODB.open function ODB.open(object_dir) end --- Destroy this object (will be called by Garbage Collector). -- --

Calls git_odb_free:

-- @name ODB:free function ODB:free() end --- object method. -- -- @param backend Must be of type ODBBackend. -- @param priority Must be of type integer. -- @return true if no error. -- @return Error string. -- @name ODB:add_backend function ODB:add_backend(backend, priority) end --- object method. -- -- @param backend Must be of type ODBBackend. -- @param priority Must be of type integer. -- @return true if no error. -- @return Error string. -- @name ODB:add_alternate function ODB:add_alternate(backend, priority) end --- object method. -- --

Calls git_odb_read:

This method queries all available ODB backends -- trying to read the given OID.

The returned object is reference counted and -- internally cached, so it should be closed -- by the user once it's no longer in use.

@return -- - 0 if the object was read; -- - GIT_ENOTFOUND if the object is not in the database. -- @param id identity of the object to read.. Must be of type OID. -- @return OdbObject or nil on error. -- @return Error string. -- @name ODB:read function ODB:read(id) end --- object method. -- --

Calls git_odb_read_prefix:

This method queries all available ODB backends -- trying to match the 'len' first hexadecimal -- characters of the 'short_id'. -- The remaining (GIT_OID_HEXSZ-len)*4 bits of -- 'short_id' must be 0s. -- 'len' must be at least GIT_OID_MINPREFIXLEN, -- and the prefix must be long enough to identify -- a unique object in all the backends; the -- method will fail otherwise.

The returned object is reference counted and -- internally cached, so it should be closed -- by the user once it's no longer in use. -- @param short_id a prefix of the id of the object to read.. Must be of type OID. -- @param len the length of the prefix. Must be of type integer. -- @return OdbObject or nil on error. -- @return Error string. -- @name ODB:read_prefix function ODB:read_prefix(short_id, len) end --- object method. -- --

Calls git_odb_read_header:

The header includes the length and the type of an object.

Note that most backends do not support reading only the header -- of an object, so the whole object will be read and then the -- header will be returned.

@return -- - 0 if the object was read; -- - GIT_ENOTFOUND if the object is not in the database. -- @param id identity of the object to read.. Must be of type OID. -- @return integer or nil on error. -- @return string or nil on error. -- @return Error string. -- @name ODB:read_header function ODB:read_header(id) end --- object method. -- --

Calls git_odb_exists:

@return -- - 1, if the object was found -- - 0, otherwise -- @param id the object to search for.. Must be of type OID. -- @return true if no error. -- @return Error string. -- @name ODB:exists function ODB:exists(id) end --- object method. -- --

Calls git_odb_write:

This method writes a full object straight into the ODB. -- For most cases, it is preferred to write objects through a write -- stream, which is both faster and less memory intensive, specially -- for big objects.

This method is provided for compatibility with custom backends -- which are not able to support streaming writes -- @param data buffer with the data to storr. Must be of type string. -- @param type type of the data to store. Must be of type string. -- @return OID or nil on error. -- @return Error string. -- @name ODB:write function ODB:write(data, type) end --- module function. -- --

Calls git_odb_hash:

The resulting SHA-1 OID will the itentifier for the data -- buffer as if the data buffer it were to written to the ODB. -- @param data data to hash. Must be of type string. -- @param otype Must be of type integer. -- @return OID or nil on error. -- @return Error string. -- @name ODB.hash function ODB.hash(data, otype) end --- module function. -- --

Calls git_odb_hashfile:

-- @param path file to read and determine object id for. Must be of type string. -- @param otype Must be of type integer. -- @return OID or nil on error. -- @return Error string. -- @name ODB.hashfile function ODB.hashfile(path, otype) end