Esempio n. 1
0
        /// <inheritdoc />
        protected override async Task WriteValueAsync(Vertex value, Stream stream, GraphBinaryWriter writer)
        {
            await writer.WriteAsync(value.Id, stream).ConfigureAwait(false);

            await writer.WriteValueAsync(value.Label, stream, false).ConfigureAwait(false);

            await writer.WriteAsync(null, stream).ConfigureAwait(false);
        }
Esempio n. 2
0
        /// <inheritdoc />
        protected override async Task WriteValueAsync(Property value, Stream stream, GraphBinaryWriter writer)
        {
            await writer.WriteValueAsync(value.Key, stream, false).ConfigureAwait(false);

            await writer.WriteAsync(value.Value, stream).ConfigureAwait(false);

            // placeholder for the parent element
            await writer.WriteAsync(null, stream).ConfigureAwait(false);
        }
Esempio n. 3
0
        /// <inheritdoc />
        protected override async Task WriteValueAsync(IDictionary <TKey, TValue> value, Stream stream, GraphBinaryWriter writer)
        {
            await writer.WriteValueAsync(value.Count, stream, false).ConfigureAwait(false);

            foreach (var key in value.Keys)
            {
                await writer.WriteAsync(key, stream).ConfigureAwait(false);

                await writer.WriteAsync(value[key], stream).ConfigureAwait(false);
            }
        }
        /// <inheritdoc />
        protected override async Task WriteValueAsync(VertexProperty value, Stream stream, GraphBinaryWriter writer)
        {
            await writer.WriteAsync(value.Id, stream).ConfigureAwait(false);

            await writer.WriteValueAsync(value.Label, stream, false).ConfigureAwait(false);

            await writer.WriteAsync(value.Value, stream).ConfigureAwait(false);

            // placeholder for the parent vertex
            await writer.WriteAsync(null, stream).ConfigureAwait(false);

            // placeholder for properties
            await writer.WriteAsync(null, stream).ConfigureAwait(false);
        }
Esempio n. 5
0
        protected override async Task WriteNonNullableValueAsync(JanusGraphP value, Stream stream,
                                                                 GraphBinaryWriter writer)
        {
            await writer.WriteValueAsync(value.OperatorName, stream, false).ConfigureAwait(false);

            await writer.WriteAsync(value.Value, stream).ConfigureAwait(false);
        }
Esempio n. 6
0
        /// <inheritdoc />
        protected override async Task WriteValueAsync(TMember[] value, Stream stream, GraphBinaryWriter writer)
        {
            await writer.WriteValueAsync(value.Length, stream, false).ConfigureAwait(false);

            foreach (var item in value)
            {
                await writer.WriteAsync(item, stream).ConfigureAwait(false);
            }
        }
Esempio n. 7
0
        private static async Task WriteArgumentsAsync(object[] arguments, Stream stream, GraphBinaryWriter writer)
        {
            await writer.WriteValueAsync(arguments.Length, stream, false).ConfigureAwait(false);

            foreach (var value in arguments)
            {
                await writer.WriteAsync(value, stream).ConfigureAwait(false);
            }
        }
Esempio n. 8
0
        /// <inheritdoc />
        protected override async Task WriteValueAsync(TSet value, Stream stream, GraphBinaryWriter writer)
        {
            var enumerable = (IEnumerable)value;
            var list       = enumerable.Cast <object>().ToList();

            await writer.WriteValueAsync(list.Count, stream, false).ConfigureAwait(false);

            foreach (var item in list)
            {
                await writer.WriteAsync(item, stream).ConfigureAwait(false);
            }
        }
Esempio n. 9
0
        /// <inheritdoc />
        protected override async Task WriteValueAsync(P value, Stream stream, GraphBinaryWriter writer)
        {
            ICollection args = value.Value is ICollection ? value.Value : new List <object> {
                value.Value
            };

            var argsLength = value.Other == null ? args.Count : args.Count + 1;

            await writer.WriteValueAsync(value.OperatorName, stream, false).ConfigureAwait(false);

            await writer.WriteValueAsync(argsLength, stream, false).ConfigureAwait(false);

            foreach (var arg in args)
            {
                await writer.WriteAsync(arg, stream).ConfigureAwait(false);
            }

            if (value.Other != null)
            {
                await writer.WriteAsync(value.Other, stream).ConfigureAwait(false);
            }
        }
Esempio n. 10
0
 /// <inheritdoc />
 protected override async Task WriteValueAsync(TEnum value, Stream stream, GraphBinaryWriter writer)
 {
     await writer.WriteAsync(value.EnumValue, stream).ConfigureAwait(false);
 }
Esempio n. 11
0
        /// <inheritdoc />
        protected override async Task WriteValueAsync(Binding value, Stream stream, GraphBinaryWriter writer)
        {
            await writer.WriteValueAsync(value.Key, stream, false).ConfigureAwait(false);

            await writer.WriteAsync(value.Value, stream).ConfigureAwait(false);
        }
Esempio n. 12
0
        /// <inheritdoc />
        protected override async Task WriteValueAsync(Traverser value, Stream stream, GraphBinaryWriter writer)
        {
            await writer.WriteValueAsync(value.Bulk, stream, false).ConfigureAwait(false);

            await writer.WriteAsync(value.Object, stream).ConfigureAwait(false);
        }
Esempio n. 13
0
        /// <inheritdoc />
        protected override async Task WriteValueAsync(Path value, Stream stream, GraphBinaryWriter writer)
        {
            await writer.WriteAsync(value.Labels, stream).ConfigureAwait(false);

            await writer.WriteAsync(value.Objects, stream).ConfigureAwait(false);
        }