コード例 #1
0
 public ESDataEndpoint(ESEndpoint endpoint, ESIndexDocType doctype)
     : base(endpoint)
 {
     this.Connection = endpoint.Connection;
     this.DocType    = doctype;
     this.cacheSize  = endpoint.CacheSize;
     if (endpoint.MaxParallel > 0)
     {
         asyncQ = AsyncRequestQueue.Create(endpoint.MaxParallel);
     }
 }
コード例 #2
0
 public ESCmdEndPoint(ESEndpoint endpoint, ESIndexDocType doctype)
     : base(endpoint)
 {
     this.Connection = endpoint.Connection;
     this.Doctype    = doctype;
 }
コード例 #3
0
        protected ESIndexDocType getDocType(String name, bool mustExcept)
        {
            ESIndexDocType ret = null;
            int            ix  = -1;
            int            cnt = 0;

            if (name != null && 0 <= (ix = name.IndexOf('.')))
            {
                ret = getDocType(name.Substring(0, ix), name.Substring(ix + 1));
                if (ret == null)
                {
                    goto EXIT_RTN;
                }
                return(ret);
            }

            if (String.IsNullOrEmpty(name))
            {
                ESIndexDefinition def = null;
                if (Indexes.Count == 1)
                {
                    def = Indexes[0];
                    if (def.DocTypes.Count == 1)
                    {
                        return(def.DocTypes[0]);
                    }
                }
                goto EXIT_RTN;
            }

            var doctype = getDocType(name, null);

            if (doctype != null)
            {
                return(doctype);
            }

            foreach (var index in Indexes)
            {
                foreach (var dt in index.DocTypes)
                {
                    if (String.Equals(name, dt.Name))
                    {
                        ret = dt;
                        cnt++;
                    }
                }
            }
            if (cnt == 1)
            {
                return(ret);
            }

EXIT_RTN:
            if (!mustExcept)
            {
                return(null);
            }
            Logger errorLog = Logs.ErrorLog;

            errorLog.Log("Type {0} is not found or is ambiguous. Found cnt={1}. All types:", name, cnt);
            foreach (var index in Indexes)
            {
                errorLog.Log("-- Index {0}:", index.Name);
                foreach (var dt in index.DocTypes)
                {
                    if (String.Equals(name, dt.Name))
                    {
                        errorLog.Log("-- -- Type {0}", dt.Name);
                    }
                }
            }
            throw new BMException("Cannot find endpoint [{0}]. It is not found or ambiguous.", name);
        }