public static async Task <Result <Directory> > GetOrAddAsync(string directoryPath, MdLocator dirLocator)
        {
            var indexer = await IndexerFactory.GetOrAddAsync(directoryPath);

            if (!indexer.HasValue)
            {
                return(Result.Fail <Directory>(indexer.ErrorCode.Value, indexer.ErrorMsg));
            }

            var dirMd = await MdAccess.LocateAsync(dirLocator).ConfigureAwait(false);

            if (!dirMd.HasValue)
            {
                return(Result.Fail <Directory>(dirMd.ErrorCode.Value, dirMd.ErrorMsg));
            }
            var dirHead   = new MdHead(dirMd.Value, directoryPath);
            var dirResult = await Directory.GetOrAddAsync(dirHead, indexer.Value);

            return(dirResult);
        }
        public static async Task <Result <Directory> > GetOrAddAsync(string directoryPath)
        {
            var indexer = await IndexerFactory.GetOrAddAsync(directoryPath);

            if (!indexer.HasValue)
            {
                return(Result.Fail <Directory>(indexer.ErrorCode.Value, indexer.ErrorMsg));
            }

            var dirLocation = new MdLocator(Encoding.UTF8.GetBytes(directoryPath), DataProtocol.DEFAULT_PROTOCOL);
            var dirMd       = await MdAccess.LocateAsync(dirLocation).ConfigureAwait(false);

            if (!dirMd.HasValue)
            {
                dirMd = Result.OK(await MdAccess.CreateAsync(0));
            }
            var dirHead   = new MdHead(dirMd.Value, directoryPath);
            var dirResult = await Directory.GetOrAddAsync(dirHead, indexer.Value);

            return(dirResult);
        }