Exemple #1
0
        public int[] AsyncWriteItems(int[] serverIds, object[] values, int transactionId, out int cancelId)
        {
            cancelId = 0;
            if (_group == null)
            {
                throw new ObjectDisposedException("Group");
            }
            if (_asyncIo == null)
            {
                throw new NotSupportedException();
            }
            if (serverIds == null)
            {
                throw new ArgumentNullException(nameof(serverIds));
            }
            if (serverIds.Length == 0)
            {
                return(new int[0]);
            }

            using (var writer = new ItemValueWriter(values))
            {
                _asyncIo.Write((uint)serverIds.Length, serverIds, writer.Values, transactionId, out var tmp, out var errorsPtr);

                cancelId = tmp;
                return(ItemResultReader.Read(serverIds.Length, errorsPtr));
            }
        }
Exemple #2
0
        public int[] SyncWriteItems(int[] serverIds, object[] values)
        {
            if (_group == null)
            {
                throw new ObjectDisposedException("Group");
            }
            if (serverIds == null)
            {
                throw new ArgumentNullException(nameof(serverIds));
            }
            if (values == null)
            {
                throw new ArgumentNullException(nameof(values));
            }
            if (serverIds.Length == 0)
            {
                return(new int[0]);
            }

            using (var writer = new ItemValueWriter(values))
            {
                _syncIo.Write((uint)serverIds.Length, serverIds, writer.Values, out var errorsPtr);
                //todo not work from many items
                //ItemResultReader.Read(serverIds.Length, errorsPtr);
                return(new[] { 0 });
            }
        }