Пример #1
0
        public SchemaProperty(LogDeserializeContext context)
        {
            Name = context.br.ReadString();
            Type = context.br.ReadString();

            IsRequired = context.br.ReadBoolean();
        }
Пример #2
0
 public Page(LogDeserializeContext context)
 {
     Uuid          = context.br.ReadGuid();
     Title         = context.br.ReadNullableString();
     Body          = context.br.ReadNullableString();
     BodyPlainText = context.br.ReadNullableString();
     BodyHtml      = context.br.ReadNullableString();
 }
Пример #3
0
 internal static void Deserialize(ILogDescriptor descriptor, LogDeserializeContext context)
 {
     descriptor.Version      = context.br.ReadUInt64();    // Version
     descriptor.PreviousHash = context.br.ReadVarBuffer(); // PreviousHash
     descriptor.HashRoot     = context.br.ReadVarBuffer(); // HashRoot
     descriptor.Timestamp    = context.br.ReadUInt128();   // Timestamp
     descriptor.Nonce        = context.br.ReadVarBuffer(); // Nonce
 }
Пример #4
0
 protected Privilege(LogDeserializeContext context)
 {
     Subject   = context.br.ReadVarBuffer();
     Type      = context.br.ReadString();
     Value     = context.br.ReadString();
     Authority = context.br.ReadVarBuffer();
     Signature = context.br.ReadVarBuffer();
 }
Пример #5
0
 public MediaEntry(LogDeserializeContext context)
 {
     Uuid   = context.br.ReadGuid();
     Type   = context.br.ReadString();
     Name   = context.br.ReadString();
     Length = context.br.ReadUInt64();
     Data   = context.br.ReadVarBuffer();
 }
        private IEnumerable <MediaEntry> Get(CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            using var tx     = env.Value.BeginTransaction(TransactionBeginFlags.ReadOnly);
            using var db     = tx.OpenDatabase(configuration: Config);
            using var cursor = tx.CreateCursor(db);

            var results = new List <MediaEntry>();

            var key = _mediaKeyBuilder.GetAllKey();

            if (cursor.SetRange(key) != MDBResultCode.Success)
            {
                return(NoEntries);
            }

            var current = cursor.GetCurrent();

            while (current.resultCode == MDBResultCode.Success && !cancellationToken.IsCancellationRequested)
            {
                unsafe
                {
                    var value = current.value.AsSpan();
                    fixed(byte *buf = &value.GetPinnableReference())
                    {
                        var ms      = new UnmanagedMemoryStream(buf, value.Length);
                        var br      = new BinaryReader(ms);
                        var context = new LogDeserializeContext(br, _typeProvider);

                        var entry = new MediaEntry(context);

                        results.Add(entry);
                    }

                    var next = cursor.Next();
                    if (next == MDBResultCode.Success)
                    {
                        current = cursor.GetCurrent();
                    }
                    else
                    {
                        break;
                    }
                }
            }

            return(results);
        }
Пример #7
0
        internal LogObject(LogDeserializeContext context)
        {
            Index     = context.br.ReadInt32();          // Index
            Type      = context.br.ReadNullableUInt64(); // Type
            Version   = context.br.ReadUInt64();         // Version
            Timestamp = context.br.ReadUInt128();        // Timestamp
            Hash      = context.br.ReadVarBuffer();      // Hash

            if (!context.br.ReadBoolean() || !Type.HasValue)
            {
                return;
            }
            var type = context.typeProvider.Get(Type.Value);

            if (type != null)
            {
                Data = context.typeProvider.Deserialize(type, context);
            }
        }
Пример #8
0
 public Namespace(LogDeserializeContext context)
 {
     Value = context.br.ReadString();
 }
Пример #9
0
 // ReSharper disable once UnusedMember.Global (needed for deserialization)
 public RevokeRole(LogDeserializeContext context) : base(context)
 {
 }
Пример #10
0
 // ReSharper disable once UnusedMember.Global (needed for deserialization)
 public GrantRole(LogDeserializeContext context) : base(context)
 {
 }
Пример #11
0
 public User(LogDeserializeContext context)
 {
     Uuid         = context.br.ReadGuid();
     Name         = context.br.ReadNullableString();
     EmailAddress = context.br.ReadNullableString();
 }