greenplumn CMDProviderRelcache 源码
greenplumn CMDProviderRelcache 代码
文件路径:/src/backend/gpopt/relcache/CMDProviderRelcache.cpp
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2011 EMC Corp.
//
// @filename:
// CMDProviderRelcache.cpp
//
// @doc:
// Implementation of a relcache-based metadata provider, which uses GPDB's
// relcache to lookup objects given their ids.
//
// @test:
//
//
//---------------------------------------------------------------------------
extern "C" {
#include "postgres.h"
}
#include "gpopt/mdcache/CMDAccessor.h"
#include "gpopt/relcache/CMDProviderRelcache.h"
#include "gpopt/translate/CTranslatorRelcacheToDXL.h"
#include "naucrates/dxl/CDXLUtils.h"
#include "naucrates/exception.h"
using namespace gpos;
using namespace gpdxl;
using namespace gpmd;
//---------------------------------------------------------------------------
// @function:
// CMDProviderRelcache::CMDProviderRelcache
//
// @doc:
// Constructs a file-based metadata provider
//
//---------------------------------------------------------------------------
CMDProviderRelcache::CMDProviderRelcache(CMemoryPool *mp) : m_mp(mp)
{
GPOS_ASSERT(nullptr != m_mp);
}
//---------------------------------------------------------------------------
// @function:
// CMDProviderRelcache::GetMDObjDXLStr
//
// @doc:
// Returns the DXL of the requested object in the provided memory pool
//
//---------------------------------------------------------------------------
CWStringBase *
CMDProviderRelcache::GetMDObjDXLStr(CMemoryPool *mp, CMDAccessor *md_accessor,
IMDId *md_id) const
{
IMDCacheObject *md_obj =
CTranslatorRelcacheToDXL::RetrieveObject(mp, md_accessor, md_id);
GPOS_ASSERT(nullptr != md_obj);
CWStringDynamic *str = CDXLUtils::SerializeMDObj(
m_mp, md_obj, true /*fSerializeHeaders*/, false /*findent*/);
// cleanup DXL object
md_obj->Release();
return str;
}
// return the requested metadata object
IMDCacheObject *
CMDProviderRelcache::GetMDObj(CMemoryPool *mp, CMDAccessor *md_accessor,
IMDId *mdid) const
{
IMDCacheObject *md_obj =
CTranslatorRelcacheToDXL::RetrieveObject(mp, md_accessor, mdid);
GPOS_ASSERT(nullptr != md_obj);
return md_obj;
}
// EOF
相关信息
相关文章
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦