public static BucketMetadata Decode(XdrDataInputStream stream)
        {
            BucketMetadata decodedBucketMetadata = new BucketMetadata();

            decodedBucketMetadata.LedgerVersion = Uint32.Decode(stream);
            decodedBucketMetadata.Ext           = BucketMetadataExt.Decode(stream);
            return(decodedBucketMetadata);
        }
        public static void Encode(XdrDataOutputStream stream, BucketEntry encodedBucketEntry)
        {
            stream.WriteInt((int)encodedBucketEntry.Discriminant.InnerValue);
            switch (encodedBucketEntry.Discriminant.InnerValue)
            {
            case BucketEntryType.BucketEntryTypeEnum.LIVEENTRY:
            case BucketEntryType.BucketEntryTypeEnum.INITENTRY:
                LedgerEntry.Encode(stream, encodedBucketEntry.LiveEntry);
                break;

            case BucketEntryType.BucketEntryTypeEnum.DEADENTRY:
                LedgerKey.Encode(stream, encodedBucketEntry.DeadEntry);
                break;

            case BucketEntryType.BucketEntryTypeEnum.METAENTRY:
                BucketMetadata.Encode(stream, encodedBucketEntry.MetaEntry);
                break;
            }
        }
Esempio n. 3
0
        public static BucketEntry Decode(XdrDataInputStream stream)
        {
            BucketEntry     decodedBucketEntry = new BucketEntry();
            BucketEntryType discriminant       = BucketEntryType.Decode(stream);

            decodedBucketEntry.Discriminant = discriminant;
            switch (decodedBucketEntry.Discriminant.InnerValue)
            {
            case BucketEntryType.BucketEntryTypeEnum.LIVEENTRY:
            case BucketEntryType.BucketEntryTypeEnum.INITENTRY:
                decodedBucketEntry.LiveEntry = LedgerEntry.Decode(stream);
                break;

            case BucketEntryType.BucketEntryTypeEnum.DEADENTRY:
                decodedBucketEntry.DeadEntry = LedgerKey.Decode(stream);
                break;

            case BucketEntryType.BucketEntryTypeEnum.METAENTRY:
                decodedBucketEntry.MetaEntry = BucketMetadata.Decode(stream);
                break;
            }
            return(decodedBucketEntry);
        }
 public static void Encode(XdrDataOutputStream stream, BucketMetadata encodedBucketMetadata)
 {
     Uint32.Encode(stream, encodedBucketMetadata.LedgerVersion);
     BucketMetadataExt.Encode(stream, encodedBucketMetadata.Ext);
 }