//private DeflateStream call_Deflate;


        private void Release()
        {
            if (unBaker != null)
            {
                unBaker.Release();
            }

            unBaker = null;
        }
        //ulong real_position = 0;
        //ulong decomp_position = 0;

        public AssetFile(string subpath, IMongoDatabase db, IMongoCollection <BakedAssets> bac, IMongoCollection <BakedVolumes> bVol = null)
        {
            this.db      = db;
            this.bac     = bac;
            this.subpath = subpath.ToLowerInvariant();   // These come in upper case occasionally

            // We may want to enforce a file heirarchy here, but for not just need an
            // asset record to match (key is simply the sha1 in lower case and text)

            var theFilter = Builders <BakedAssets> .Filter.Eq("_id", this.subpath);

            baRec = bac.FindSync(theFilter).FirstOrDefault();

            // This file could conceivably exist as an unanneled file but we would
            // need a different abstraction here to read it -- we can generate a different
            // Stream, but we will need a different file service
            // Also this scheme needs access controls
            if (baRec == null)
            {
                Console.WriteLine($"Can't file BakedAsset: _id: {this.subpath}");
                return;
            }

            var vCol = bVol;

            if (vCol == null)
            {
                vCol = db.BakedVolumes();
            }

            try
            {
                var volFilter = Builders <BakedVolumes> .Filter.Eq("_id", baRec.Volume);

                volRec = vCol.FindSync(volFilter).FirstOrDefault();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: ${ex.Message}");
            }

            unBaker = new UnbakeContext(db, volRec, baRec);

            //var channel = GrpcChannel.ForAddress("http://feanor:5000");
            //assetClient = new BakedVolumeData.BakedVolumeDataClient(channel);
        }