Example #1
0
 public CloudLoader(FileLoader fl, int BlockSize, string Relocs) : this()
 {
     FL          = fl;
     MinHashSize = BlockSize;
     RelocDir    = Relocs;
 }
Example #2
0
        public MetaDB(string WorkingDir, int minHashSize = 256, long DBSize = 0, int loadBufferCount = 50000000, string NewInfoString = null)
        {
            RootFolder = WorkingDir;
            if (!Directory.Exists(RootFolder))
            {
                Directory.CreateDirectory(RootFolder);
            }

            MDBName         = Path.Combine(RootFolder, mdbName);
            HDBName         = Path.Combine(RootFolder, hdbName);
            BDBName         = Path.Combine(RootFolder, bdbName);
            RelocName       = Path.Combine(RootFolder, relocFolder);
            LoadBufferCount = loadBufferCount;

            if (File.Exists(MDBName))
            {
                xDoc = XDocument.Load(MDBName);
            }
            else
            {
                xDoc = new XDocument(new XDeclaration("1.0", Encoding.Default.WebName, "yes"), new XElement(ElementNames.xRoot));
            }

            mData = xDoc.Root;

            var currID = ((Int32?)mData.Attribute(AttributeNames.xNextHashID) ?? 0);

            if (currID == 0)
            {
                mData.SetAttributeValue(AttributeNames.xNextHashID, 1);
                currHID = 1;
            }
            else
            {
                currHID = currID;
            }

            if (mData.Element(ElementNames.xRecords) != null)
            {
                mRecords = mData.Element(ElementNames.xRecords);
            }
            else
            {
                mRecords = new XElement(ElementNames.xRecords);
                mData.Add(mRecords);
            }

            if (mData.Element(ElementNames.xMetaInfoStrings) != null)
            {
                infoStrings = mData.Element(ElementNames.xMetaInfoStrings);
            }
            else
            {
                infoStrings = new XElement(ElementNames.xMetaInfoStrings);
                mData.Add(infoStrings);
            }
            infoString  = NewInfoString;
            MinHashSize = minHashSize;

            ReRe = new ReReDB(RelocName);

            HDB      = new HashDB(MinHashSize, HDBName, RelocName, DBSize);
            HDB.ReRe = ReRe;

            Loader = new FileLoader(this, LoadBufferCount, infoString);

            cLoader            = new CloudLoader(Loader, MinHashSize, RelocName);
            cLoader.InfoString = infoString;
            ReRe.AzureCnx      = cLoader;
        }