public AppKfsPhase2Item(IAppHelper _helper, List<KfsServerOp> _operations, SortedDictionary<UInt64, List<KfsServerOp>> seenPhase1Ops)
            : base(_helper, _operations)
        {
            Debug.Assert(m_ops.Count > 0);

            FirstOp = m_ops[0] as KfsPhase2ServerOp;
            Debug.Assert(seenPhase1Ops.ContainsKey(FirstOp.CommitID));
            // FIXME seenPhase1Ops might be empty if the KWM is closed between the phase1 and the phase2 event.
            m_seenPhase1Ops = seenPhase1Ops[FirstOp.CommitID];
            seenPhase1Ops.Remove(FirstOp.CommitID);

            Debug.Assert(FirstOp != null);
        }
Beispiel #2
0
        /// <summary>
        /// Extract the operation contained in the phase 2 event message specified.
        /// </summary>
        public void DecomposePhase2Event(AnpMsg m, out KfsPhase2ServerOp op)
        {
            UInt64 eid = m.ID;
            UInt64 date = m.Elements[1].UInt64;
            UInt32 uid = m.Elements[2].UInt32;
            UInt64 cid = m.Elements[4].UInt64;
            UInt32 nbFile = m.Elements[5].UInt32;
            int pos = 6;
            op = new KfsPhase2ServerOp(Share, eid, date, uid, cid);

            for (int i = 0; i < nbFile; i++)
            {
                KfsServerPhase2File f = new KfsServerPhase2File();
                f.Inode = m.Elements[pos + 0].UInt64;
                f.Size = m.Elements[pos + 1].UInt64;
                f.Hash = m.Elements[pos + 2].Bin;
                op.UploadArray.Add(f);
                pos += 3;
            }
        }