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();
 }