예제 #1
0
        public static async Task <IMdNode> CreateNewMdNodeAsync(int level, Session session, ulong protocol)
        {
            var networkDataOps = new NetworkDataOps(session);
            var mdInfo         = await networkDataOps.CreateEmptyMd(protocol);

            var newMd = new MdNode(mdInfo, session);
            await newMd.Initialize(level).ConfigureAwait(false);

            return(newMd);
        }
예제 #2
0
        public static async Task <Result <IMdNode> > LocateAsync(MdLocator location, Session session)
        {
            var networkDataOps = new NetworkDataOps(session);

            // var mdResult = await networkDataOps.LocatePublicMd(location.XORName, location.TypeTag);
            var mdResult = await networkDataOps.LocatePrivateMd(location.XORName, location.TypeTag, location.SecEncKey, location.Nonce);

            if (!mdResult.HasValue)
            {
                return(new KeyNotFound <IMdNode>($"Could not locate md: {location.TypeTag}, {location.XORName}"));
            }

            var mdInfo = mdResult.Value;
            var md     = new MdNode(mdInfo, networkDataOps.Session);
            await md.GetOrAddMetadata();

            return(Result.OK((IMdNode)md));
        }
 public Task <Result <IMdNode> > LocateMdNode(MdLocator location)
 {
     return(MdNode.LocateAsync(location, _dataOps.Session));
 }
 public Task <IMdNode> CreateNewMdNode(int level, ulong protocol)
 {
     return(MdNode.CreateNewMdNodeAsync(level, _dataOps.Session, protocol));
 }