ReleaseDB¶
-
contract
ReleaseDB
is Authorized¶ Title: Database contract for a package index. Author: Tim Coulter <tim.coulter@consensys.net>, Piper Merriam <pipermerriam@gmail.com> -
mapping (bytes32 => Release)
_recordedReleases
¶
-
mapping (bytes32 => bool)
_removedReleases
¶
-
IndexedOrderedSetLib.IndexedOrderedSet
_allReleaseIds
¶
-
mapping (bytes32 => IndexedOrderedSetLib.IndexedOrderedSet)
_releaseIdsByNameHash
¶
-
mapping (bytes32 => string)
_recordedVersions
¶
-
mapping (bytes32 => bool)
_versionExists
¶
-
function
setRelease
(bytes32 nameHash, bytes32 versionHash, string manifestURI)¶
public
auth
returns (bool)
¶ Creates or updates a release for a package. Returns success.
Parameters: - nameHash – The name hash of the package.
- versionHash – The version hash for the release version.
- manifestURI – The URI for the release manifest for this release.
-
function
removeRelease
(bytes32 releaseId, string reason)¶
public
auth
onlyIfReleaseExists(releaseId)
returns (bool)
¶ Removes a release from a package. Returns success.
Parameters: - releaseId – The release hash to be removed
- reason – Explanation for why the removal happened.
-
function
setVersion
(string version)¶
public
auth
returns (bytes32)
¶ Adds the given version to the local version database. Returns the versionHash for the provided version.
Parameters: - version – Version string (ex: ‘1.0.0’)
-
function
getAllReleaseIds
(bytes32 nameHash, uint _offset, uint limit)¶
public
view
returns (bytes32[] releaseIds, uint offset)
¶ Returns a slice of the array of all releases hashes for the named package.
Parameters: - offset – The starting index for the slice.
- limit – The length of the slice
-
function
getNumReleasesForNameHash
(bytes32 nameHash)¶
public
view
returns (uint)
¶ Get the total number of releases
Parameters: - nameHash – the name hash to lookup.
-
function
getReleaseIdForNameHash
(bytes32 nameHash, uint idx)¶
public
view
returns (bytes32)
¶ Release hash for a Package at a given index
Parameters: - nameHash – the name hash to lookup.
- idx – The index of the release hash to retrieve.
-
function
releaseExists
(bytes32 releaseId)¶
public
view
returns (bool)
¶ Query the existence of a release at the provided version for a package. Returns boolean indicating whether such a release exists.
Parameters: - releaseId – The release hash to query.
-
function
releaseExisted
(bytes32 releaseHash)¶
public
view
returns (bool)
¶ Query the past existence of a release at the provided version for a package. Returns boolean indicating whether such a release ever existed.
Parameters: - releaseHash – The release hash to query.
-
function
versionExists
(bytes32 versionHash)¶
public
view
returns (bool)
¶ Query the existence of the provided version in the recorded versions. Returns boolean indicating whether such a version exists.
Parameters: - versionHash – the version hash to check.
-
function
getReleaseData
(bytes32 releaseId)¶
public
view
onlyIfReleaseExists(releaseId)
returns (bytes32 nameHash, bytes32 versionHash, uint createdAt, uint updatedAt)
¶ Returns the releaseData for the given release has a package.
Parameters: - releaseId – The release hash.
-
function
getVersion
(bytes32 versionHash)¶
public
view
onlyIfVersionExists(versionHash)
returns (string)
¶ Returns string version identifier from the version of the given release hash.
Parameters: - versionHash – the version hash
-
function
getManifestURI
(bytes32 releaseId)¶
public
view
onlyIfReleaseExists(releaseId)
returns (string)
¶ Returns the URI of the release manifest for the given release hash.
Parameters: - releaseId – Release hash
-
mapping (bytes32 => Release)