Example #1
0
func NewMetadataRepo(requestAddr string,
	leaderAddr string,
	config string,
	mgr *IndexManager) (*MetadataRepo, error) {

	ref, err := newRemoteRepoRef(requestAddr, leaderAddr, config, mgr)
	if err != nil {
		return nil, err
	}
	repo := &MetadataRepo{repo: ref,
		isClosed:   false,
		defnCache:  make(map[common.IndexDefnId]*common.IndexDefn),
		topoCache:  make(map[string]*IndexTopology),
		globalTopo: nil}

	if err := repo.loadDefn(); err != nil {
		return nil, err
	}

	if err := repo.loadTopology(); err != nil {
		return nil, err
	}

	return repo, nil
}
Example #2
0
func NewLocalMetadataRepo(msgAddr string,
	eventMgr *eventManager,
	reqHandler protocol.CustomRequestHandler,
	repoName string,
	quota uint64) (*MetadataRepo, RequestServer, error) {

	ref, err := newLocalRepoRef(msgAddr, eventMgr, reqHandler, repoName, quota)
	if err != nil {
		return nil, nil, err
	}
	repo := &MetadataRepo{repo: ref,
		isClosed:   false,
		defnCache:  make(map[common.IndexDefnId]*common.IndexDefn),
		topoCache:  make(map[string]*IndexTopology),
		globalTopo: nil}

	if err := repo.loadDefn(); err != nil {
		return nil, nil, err
	}

	if err := repo.loadTopology(); err != nil {
		return nil, nil, err
	}

	return repo, ref.server, nil
}