Esempio n. 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);
        }
Esempio n. 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 MdHeadManager(Session session, string appId, ulong protocol)
 {
     APP_CONTAINER_PATH = $"apps/{appId}";
     _protocol          = protocol;
     _dataOps           = new NetworkDataOps(session);
 }