Return Type | Function name | Arguments |
---|---|---|
hzEcode | hdbObjRepos::InitStart | (const hdbClass*,const hzString&,const hzString&,hdbReposMode,) |
Declared in file: hzDatabase.h
Defined in file : hdbObjRepos.cpp
Function Logic:
Function body:
hzEcode hdbObjRepos::InitStart (const hdbClass* pNative, const hzString& name, const hzString& workdir, hdbReposMode eMode) { _hzfunc("hdbObjRepos::InitStart") ; hzEcode rc ; if (!this) hzexit(E_CORRUPT, "No hdbObjRepos instance") ; _hdb_ck_initstate(name, m_eReposInit, HDB_CLASS_INIT_NONE) ; if (!pNative) return hzerr(E_ARGUMENT, "No data class supplied") ; if (!pNative->IsInit()) return hzerr(E_NOINIT, "Supplied class (%s) is not initialized", pNative->txtName()) ; if (pNative->HasBinaries()) { if (eMode == HDB_REPOS_CACHE) { hzwarn(E_TYPE, "Ignoring CACHE mode, using DUAL") ; eMode = HDB_REPOS_DUAL ; } } if (!name) return hzerr(E_ARGUMENT, "No name supplied") ; if (m_pADP->GetObjRepos(name)) return hzerr(E_DUPLICATE, "Repository %s already exists", *name) ; if (!workdir) return hzerr(E_ARGUMENT, "No working directory supplied for object cache %s", *name) ; rc = AssertDir(*workdir, 0777); if (rc != E_OK) return hzerr(rc, "Cannot assert working directory %s for object cache %s\n", *workdir, *name) ; m_pClass = pNative ; m_Name = name ; m_Workdir = workdir ; if (eMode == HDB_REPOS_HARD || eMode == HDB_REPOS_DUAL) { if (pNative->HasBinaries()) { m_nameBR_Datum = m_Name + "_br_datum" ; m_pBR_Datum = new hdbBinRepos(*m_pADP) ; rc = m_pBR_Datum->Init(m_nameBR_Datum, m_Workdir) ; if (rc != E_OK) return hzerr(rc, "Failed to initialize binary data store: Repos %s, Datum BR (%s), workdir %s\n", *m_Name, *m_nameBR_Datum, *m_Workdir) ; } if (!m_pBR_Delta) { m_nameBR_Delta = m_Name + "_br_delta" ; m_pBR_Delta = new hdbBinRepos(*m_pADP) ; rc = m_pBR_Delta->Init(m_nameBR_Delta, m_Workdir) ; if (rc != E_OK) return hzerr(rc, "Failed to initialize binary data store %s (%s)\n", *m_nameBR_Delta, *m_Workdir) ; } } if (eMode == HDB_REPOS_CACHE || eMode == HDB_REPOS_DUAL) { m_pathCD = m_Workdir ; m_pathCD += "/" ; m_pathCD += m_Name ; m_pathCD += ".cache" ; m_pMain = new _cache() ; m_pMain->Init(m_pClass) ; } m_eReposInit = HDB_REPOS_INIT_PROG ; m_pADP->RegisterObjRepos(this) ; return E_OK ; }