Example #1
0
        /// <summary>
        /// Writes the configuration to writer.
        /// </summary>
        public static void Write(IBinaryRawWriter writer, ISwapSpaceSpi spi)
        {
            Debug.Assert(writer != null);

            var fileSwap = spi as FileSwapSpaceSpi;

            if (spi == null)
            {
                writer.WriteByte((byte) Type.None);
            }
            else if (fileSwap != null)
            {
                writer.WriteByte((byte) Type.File);

                writer.WriteString(fileSwap.BaseDirectory);
                writer.WriteFloat(fileSwap.MaximumSparsity);
                writer.WriteInt(fileSwap.MaximumWriteQueueSize);
                writer.WriteInt(fileSwap.ReadStripesNumber);
                writer.WriteInt(fileSwap.WriteBufferSize);

            }
            else
            {
                throw new InvalidOperationException("Unsupported swap space SPI: " + spi.GetType());
            }
        }
        /// <summary>
        /// Writes this instance to the specified writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal void Write(IBinaryRawWriter writer)
        {
            Debug.Assert(writer != null);

            writer.WriteString(PersistentStorePath);
            writer.WriteTimeSpanAsLong(CheckpointingFrequency);
            writer.WriteLong(CheckpointingPageBufferSize);
            writer.WriteInt(CheckpointingThreads);
            writer.WriteTimeSpanAsLong(LockWaitTime);
            writer.WriteInt(WalHistorySize);
            writer.WriteInt(WalSegments);
            writer.WriteInt(WalSegmentSize);
            writer.WriteString(WalStorePath);
            writer.WriteString(WalArchivePath);
            writer.WriteInt((int)WalMode);
            writer.WriteInt(TlbSize);
            writer.WriteTimeSpanAsLong(WalFlushFrequency);
            writer.WriteLong(WalFsyncDelayNanos);
            writer.WriteInt(WalRecordIteratorBufferSize);
            writer.WriteBoolean(AlwaysWriteFullPages);
            writer.WriteBoolean(MetricsEnabled);
            writer.WriteInt(SubIntervals);
            writer.WriteTimeSpanAsLong(RateTimeInterval);
        }
Example #3
0
        /// <summary>
        /// Serializes the Service configuration using IBinaryRawWriter
        /// </summary>
        /// <param name="w">IBinaryRawWriter</param>
        internal void Write(IBinaryRawWriter w)
        {
            Debug.Assert(w != null);

            w.WriteString(Name);
            w.WriteObject(Service);
            w.WriteInt(TotalCount);
            w.WriteInt(MaxPerNodeCount);
            w.WriteString(CacheName);
            w.WriteObject(AffinityKey);

            if (NodeFilter != null)
            {
                w.WriteObject(NodeFilter);
            }
            else
            {
                w.WriteObject <object>(null);
            }

            w.WriteBoolean(StatisticsEnabled);

            WriteExtraDescription(w);
        }
Example #4
0
        /// <summary>
        /// Writes the SQL fields query.
        /// </summary>
        private static void WriteSqlFieldsQuery(IBinaryRawWriter writer, SqlFieldsQuery qry,
                                                bool includeColumns = true)
        {
            Debug.Assert(qry != null);

            writer.WriteString(qry.Schema);
            writer.WriteInt(qry.PageSize);
            writer.WriteInt(-1);  // maxRows: unlimited
            writer.WriteString(qry.Sql);
            QueryBase.WriteQueryArgs(writer, qry.Arguments);

            // .NET client does not discern between different statements for now.
            // We cound have ExecuteNonQuery method, which uses StatementType.Update, for example.
            writer.WriteByte((byte)StatementType.Any);

            writer.WriteBoolean(qry.EnableDistributedJoins);
            writer.WriteBoolean(qry.Local);
            writer.WriteBoolean(qry.ReplicatedOnly);
            writer.WriteBoolean(qry.EnforceJoinOrder);
            writer.WriteBoolean(qry.Colocated);
            writer.WriteBoolean(qry.Lazy);
            writer.WriteTimeSpanAsLong(qry.Timeout);
            writer.WriteBoolean(includeColumns);
        }
Example #5
0
        /// <summary>
        /// Writes this instance.
        /// </summary>
        internal void Write(IBinaryRawWriter writer)
        {
            writer.WriteString(KeyTypeName);
            writer.WriteString(ValueTypeName);

            if (Fields != null)
            {
                writer.WriteInt(Fields.Count);

                foreach (var field in Fields)
                {
                    writer.WriteString(field.Name);
                    writer.WriteString(field.FieldTypeName);
                    writer.WriteBoolean(field.IsKeyField);
                }
            }
            else
            {
                writer.WriteInt(0);
            }


            if (Aliases != null)
            {
                writer.WriteInt(Aliases.Count);

                foreach (var queryAlias in Aliases)
                {
                    writer.WriteString(queryAlias.FullName);
                    writer.WriteString(queryAlias.Alias);
                }
            }
            else
            {
                writer.WriteInt(0);
            }

            if (Indexes != null)
            {
                writer.WriteInt(Indexes.Count);

                foreach (var index in Indexes)
                {
                    if (index == null)
                    {
                        throw new InvalidOperationException("Invalid cache configuration: QueryIndex can't be null.");
                    }

                    index.Write(writer);
                }
            }
            else
            {
                writer.WriteInt(0);
            }
        }
Example #6
0
        /// <summary>
        /// Writes the key.
        /// </summary>
        private static void WriteKey(DbCacheKey key, IBinaryRawWriter writer, bool includeNames)
        {
            writer.WriteString(key.Key);

            if (key.EntitySetVersions != null)
            {
                writer.WriteInt(key.EntitySetVersions.Count);

                // Versions should be in the same order, so we can't iterate over the dictionary.
                foreach (var entitySet in key.EntitySets)
                {
                    writer.WriteLong(key.EntitySetVersions[entitySet.Name]);

                    if (includeNames)
                    {
                        writer.WriteString(entitySet.Name);
                    }
                }
            }
            else
            {
                writer.WriteInt(-1);
            }
        }
Example #7
0
        public override void InternalToBinary(IBinaryRawWriter writer)
        {
            base.InternalToBinary(writer);

            VersionSerializationHelper.EmitVersionByte(writer, VERSION_NUMBER);

            writer.WriteBoolean(Undo);
            writer.WriteGuid(ProjectID);
            writer.WriteGuid(AssetID);
            writer.WriteLong(StartUTC.ToBinary());
            writer.WriteLong(EndUTC.ToBinary());
            writer.WriteString(MachineDesignName);
            writer.WriteBoolean(LayerID.HasValue);
            if (LayerID.HasValue)
            {
                writer.WriteInt(LayerID.Value);
            }
        }
        /// <summary>
        /// Writes to the specified writer.
        /// </summary>
        internal void Write(IBinaryRawWriter writer)
        {
            Debug.Assert(writer != null);

            writer.WriteString(Host);
            writer.WriteInt(Port);
            writer.WriteInt(PortRange);
            writer.WriteInt(SocketSendBufferSize);
            writer.WriteInt(SocketReceiveBufferSize);
            writer.WriteBoolean(TcpNoDelay);
            writer.WriteInt(MaxOpenCursorsPerConnection);
            writer.WriteInt(ThreadPoolSize);
            writer.WriteTimeSpanAsLong(IdleTimeout);

            writer.WriteBoolean(ThinClientEnabled);
            writer.WriteBoolean(OdbcEnabled);
            writer.WriteBoolean(JdbcEnabled);
        }
Example #9
0
        /// <summary>
        /// Writes this instance to the specified writer.
        /// </summary>
        internal void Write(IBinaryRawWriter writer)
        {
            var ipFinder = IpFinder;

            if (ipFinder != null)
            {
                writer.WriteBoolean(true);

                var finder = ipFinder as TcpDiscoveryIpFinderBase;

                if (finder == null)
                {
                    throw new InvalidOperationException("Unsupported IP finder: " + ipFinder.GetType());
                }

                finder.Write(writer);
            }
            else
            {
                writer.WriteBoolean(false);
            }

            writer.WriteLong((long)SocketTimeout.TotalMilliseconds);
            writer.WriteLong((long)AckTimeout.TotalMilliseconds);
            writer.WriteLong((long)MaxAckTimeout.TotalMilliseconds);
            writer.WriteLong((long)NetworkTimeout.TotalMilliseconds);
            writer.WriteLong((long)JoinTimeout.TotalMilliseconds);

            writer.WriteBoolean(ForceServerMode);
            writer.WriteBoolean(ClientReconnectDisabled);
            writer.WriteString(LocalAddress);
            writer.WriteInt(ReconnectCount);
            writer.WriteInt(LocalPort);
            writer.WriteInt(LocalPortRange);
            writer.WriteInt(MaxMissedHeartbeats);
            writer.WriteInt(MaxMissedClientHeartbeats);
            writer.WriteLong((long)StatisticsPrintFrequency.TotalMilliseconds);
            writer.WriteLong((long)IpFinderCleanFrequency.TotalMilliseconds);
            writer.WriteInt(ThreadPriority);
            writer.WriteLong((long)HeartbeatFrequency.TotalMilliseconds);
            writer.WriteInt(TopologyHistorySize);
        }
Example #10
0
 /// <summary>
 /// Writes this instance to the specified writer.
 /// </summary>
 internal void Write(IBinaryRawWriter writer)
 {
     writer.WriteInt(AckSendThreshold);
     writer.WriteLong((long)ConnectTimeout.TotalMilliseconds);
     writer.WriteBoolean(DirectBuffer);
     writer.WriteBoolean(DirectSendBuffer);
     writer.WriteLong((long)IdleConnectionTimeout.TotalMilliseconds);
     writer.WriteString(LocalAddress);
     writer.WriteInt(LocalPort);
     writer.WriteInt(LocalPortRange);
     writer.WriteLong((long)MaxConnectTimeout.TotalMilliseconds);
     writer.WriteInt(MessageQueueLimit);
     writer.WriteInt(ReconnectCount);
     writer.WriteInt(SelectorsCount);
     writer.WriteInt(SlowClientQueueLimit);
     writer.WriteInt(SocketReceiveBufferSize);
     writer.WriteInt(SocketSendBufferSize);
     writer.WriteBoolean(TcpNoDelay);
     writer.WriteInt(UnacknowledgedMessagesBufferSize);
 }
Example #11
0
        /** <inheritdoc /> */
        internal override void Write(IBinaryRawWriter writer)
        {
            base.Write(writer);

            var eps = Endpoints;

            if (eps != null)
            {
                writer.WriteInt(eps.Count);

                foreach (var ep in eps)
                {
                    writer.WriteString(ep);
                }
            }
            else
            {
                writer.WriteInt(0);
            }
        }
        /// <summary>
        /// Writes to the specified writer.
        /// </summary>
        internal void Write(ClientProtocolVersion ver, IBinaryRawWriter writer)
        {
            Debug.Assert(writer != null);

            writer.WriteString(Host);
            writer.WriteInt(Port);
            writer.WriteInt(PortRange);
            writer.WriteInt(SocketSendBufferSize);
            writer.WriteInt(SocketReceiveBufferSize);
            writer.WriteBoolean(TcpNoDelay);
            writer.WriteInt(MaxOpenCursorsPerConnection);
            writer.WriteInt(ThreadPoolSize);
            writer.WriteTimeSpanAsLong(IdleTimeout);

            writer.WriteBoolean(ThinClientEnabled);
            writer.WriteBoolean(OdbcEnabled);
            writer.WriteBoolean(JdbcEnabled);

            if (ver.CompareTo(ClientSocket.Ver130) >= 0)
            {
                writer.WriteTimeSpanAsLong(HandshakeTimeout);
            }
        }
Example #13
0
        /// <summary>
        /// Writes this instane to the specified writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal void Write(IBinaryRawWriter writer)
        {
            writer.WriteInt((int) AtomicityMode);
            writer.WriteInt((int) AtomicWriteOrderMode);
            writer.WriteInt(Backups);
            writer.WriteInt((int) CacheMode);
            writer.WriteBoolean(CopyOnRead);
            writer.WriteBoolean(EagerTtl);
            writer.WriteBoolean(EnableSwap);
            writer.WriteBoolean(EvictSynchronized);
            writer.WriteInt(EvictSynchronizedConcurrencyLevel);
            writer.WriteInt(EvictSynchronizedKeyBufferSize);
            writer.WriteLong((long) EvictSynchronizedTimeout.TotalMilliseconds);
            writer.WriteBoolean(Invalidate);
            writer.WriteBoolean(KeepBinaryInStore);
            writer.WriteBoolean(LoadPreviousValue);
            writer.WriteLong((long) LockTimeout.TotalMilliseconds);
            writer.WriteLong((long) LongQueryWarningTimeout.TotalMilliseconds);
            writer.WriteInt(MaxConcurrentAsyncOperations);
            writer.WriteFloat(MaxEvictionOverflowRatio);
            writer.WriteInt((int) MemoryMode);
            writer.WriteString(Name);
            writer.WriteLong(OffHeapMaxMemory);
            writer.WriteBoolean(ReadFromBackup);
            writer.WriteInt(RebalanceBatchSize);
            writer.WriteLong((long) RebalanceDelay.TotalMilliseconds);
            writer.WriteInt((int) RebalanceMode);
            writer.WriteLong((long) RebalanceThrottle.TotalMilliseconds);
            writer.WriteLong((long) RebalanceTimeout.TotalMilliseconds);
            writer.WriteBoolean(SqlEscapeAll);
            writer.WriteInt(SqlOnheapRowCacheSize);
            writer.WriteInt(StartSize);
            writer.WriteInt(WriteBehindBatchSize);
            writer.WriteBoolean(WriteBehindEnabled);
            writer.WriteLong((long) WriteBehindFlushFrequency.TotalMilliseconds);
            writer.WriteInt(WriteBehindFlushSize);
            writer.WriteInt(WriteBehindFlushThreadCount);
            writer.WriteInt((int) WriteSynchronizationMode);
            writer.WriteObject(CacheStoreFactory);

            if (QueryEntities != null)
            {
                writer.WriteInt(QueryEntities.Count);

                foreach (var entity in QueryEntities)
                {
                    if (entity == null)
                        throw new InvalidOperationException("Invalid cache configuration: QueryEntity can't be null.");

                    entity.Write(writer);
                }
            }
            else
                writer.WriteInt(0);
        }
Example #14
0
        /// <summary>
        /// Writes this instance.
        /// </summary>
        internal void Write(IBinaryRawWriter writer)
        {
            writer.WriteString(Name);
            writer.WriteByte((byte) IndexType);

            if (Fields != null)
            {
                writer.WriteInt(Fields.Count);

                foreach (var field in Fields)
                {
                    writer.WriteString(field.Name);
                    writer.WriteBoolean(field.IsDescending);
                }
            }
            else
                writer.WriteInt(0);
        }
        /** <inheritdoc /> */
        internal override void Write(IBinaryRawWriter writer)
        {
            base.Write(writer);

            writer.WriteString(LocalAddress);
            writer.WriteString(MulticastGroup);
            writer.WriteInt(MulticastPort);
            writer.WriteInt(AddressRequestAttempts);
            writer.WriteInt((int) ResponseTimeout.TotalMilliseconds);

            writer.WriteBoolean(TimeToLive.HasValue);

            if (TimeToLive.HasValue)
                writer.WriteInt(TimeToLive.Value);
        }
        /// <summary>
        /// Writes this object to the given writer.
        /// </summary>
        public void WriteBinary(IBinaryRawWriter writer, bool changesOnly)
        {
            IgniteArgumentCheck.NotNull(writer, "writer");

            if (_isNew || _dirtyAll || !changesOnly || (_removedKeys == null && _list.All(x => x.IsDirty)))
            {
                // Write in full mode.
                writer.WriteInt(_list.Count);

                foreach (var entry in _list)
                {
                    writer.WriteString(entry.Key);

                    // Write as byte array to enable partial deserialization.
                    writer.WriteByteArray(entry.GetBytes());
                }
            }
            else
            {
                // Write in diff mode.
                var removed = GetRemovedKeys();

                var count = _list.Count(x => x.IsDirty) + (removed == null ? 0 : removed.Count);

                writer.WriteInt(count);  // reserve count

                // Write removed keys as [key + null].
                if (removed != null)
                {
                    foreach (var removedKey in removed)
                    {
                        writer.WriteString(removedKey);
                        writer.WriteByteArray(null);
                    }
                }

                // Write dirty items.
                foreach (var entry in _list)
                {
                    if (!entry.IsDirty)
                        continue;

                    writer.WriteString(entry.Key);

                    // Write as byte array to enable partial deserialization.
                    writer.WriteByteArray(entry.GetBytes());
                }
            }
        }
 /** <inheritdoc /> */
 public void WriteBinary(IBinaryRawWriter writer)
 {
     writer.WriteString(Foo);
 }
Example #18
0
        /// <summary>
        /// Writes this instance to the specified writer.
        /// </summary>
        internal void Write(IBinaryRawWriter writer)
        {
            var ipFinder = IpFinder;

            if (ipFinder != null)
            {
                writer.WriteBoolean(true);

                var finder = ipFinder as TcpDiscoveryIpFinderBase;

                if (finder == null)
                    throw new InvalidOperationException("Unsupported IP finder: " + ipFinder.GetType());

                finder.Write(writer);
            }
            else
                writer.WriteBoolean(false);

            writer.WriteLong((long) SocketTimeout.TotalMilliseconds);
            writer.WriteLong((long) AckTimeout.TotalMilliseconds);
            writer.WriteLong((long) MaxAckTimeout.TotalMilliseconds);
            writer.WriteLong((long) NetworkTimeout.TotalMilliseconds);
            writer.WriteLong((long) JoinTimeout.TotalMilliseconds);

            writer.WriteBoolean(ForceServerMode);
            writer.WriteBoolean(ClientReconnectDisabled);
            writer.WriteString(LocalAddress);
            writer.WriteInt(ReconnectCount);
            writer.WriteInt(LocalPort);
            writer.WriteInt(LocalPortRange);
            writer.WriteInt(MaxMissedHeartbeats);
            writer.WriteInt(MaxMissedClientHeartbeats);
            writer.WriteLong((long) StatisticsPrintFrequency.TotalMilliseconds);
            writer.WriteLong((long) IpFinderCleanFrequency.TotalMilliseconds);
            writer.WriteInt(ThreadPriority);
            writer.WriteLong((long) HeartbeatFrequency.TotalMilliseconds);
            writer.WriteInt(TopologyHistorySize);
        }
Example #19
0
        /// <summary>
        /// Writes this instance to the specified writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal void Write(IBinaryRawWriter writer)
        {
            writer.WriteInt((int)AtomicityMode);
            writer.WriteInt((int)AtomicWriteOrderMode);
            writer.WriteInt(Backups);
            writer.WriteInt((int)CacheMode);
            writer.WriteBoolean(CopyOnRead);
            writer.WriteBoolean(EagerTtl);
            writer.WriteBoolean(EnableSwap);
            writer.WriteBoolean(EvictSynchronized);
            writer.WriteInt(EvictSynchronizedConcurrencyLevel);
            writer.WriteInt(EvictSynchronizedKeyBufferSize);
            writer.WriteLong((long)EvictSynchronizedTimeout.TotalMilliseconds);
            writer.WriteBoolean(Invalidate);
            writer.WriteBoolean(KeepBinaryInStore);
            writer.WriteBoolean(LoadPreviousValue);
            writer.WriteLong((long)LockTimeout.TotalMilliseconds);
            writer.WriteLong((long)LongQueryWarningTimeout.TotalMilliseconds);
            writer.WriteInt(MaxConcurrentAsyncOperations);
            writer.WriteFloat(MaxEvictionOverflowRatio);
            writer.WriteInt((int)MemoryMode);
            writer.WriteString(Name);
            writer.WriteLong(OffHeapMaxMemory);
            writer.WriteBoolean(ReadFromBackup);
            writer.WriteInt(RebalanceBatchSize);
            writer.WriteLong((long)RebalanceDelay.TotalMilliseconds);
            writer.WriteInt((int)RebalanceMode);
            writer.WriteLong((long)RebalanceThrottle.TotalMilliseconds);
            writer.WriteLong((long)RebalanceTimeout.TotalMilliseconds);
            writer.WriteBoolean(SqlEscapeAll);
            writer.WriteInt(SqlOnheapRowCacheSize);
            writer.WriteInt(StartSize);
            writer.WriteInt(WriteBehindBatchSize);
            writer.WriteBoolean(WriteBehindEnabled);
            writer.WriteLong((long)WriteBehindFlushFrequency.TotalMilliseconds);
            writer.WriteInt(WriteBehindFlushSize);
            writer.WriteInt(WriteBehindFlushThreadCount);
            writer.WriteInt((int)WriteSynchronizationMode);
            writer.WriteBoolean(ReadThrough);
            writer.WriteBoolean(WriteThrough);
            writer.WriteBoolean(EnableStatistics);
            writer.WriteObject(CacheStoreFactory);

            if (QueryEntities != null)
            {
                writer.WriteInt(QueryEntities.Count);

                foreach (var entity in QueryEntities)
                {
                    if (entity == null)
                    {
                        throw new InvalidOperationException("Invalid cache configuration: QueryEntity can't be null.");
                    }

                    entity.Write(writer);
                }
            }
            else
            {
                writer.WriteInt(0);
            }

            if (NearConfiguration != null)
            {
                writer.WriteBoolean(true);
                NearConfiguration.Write(writer);
            }
            else
            {
                writer.WriteBoolean(false);
            }

            EvictionPolicyBase.Write(writer, EvictionPolicy);
            AffinityFunctionSerializer.Write(writer, AffinityFunction);
            ExpiryPolicySerializer.WritePolicyFactory(writer, ExpiryPolicyFactory);

            if (PluginConfigurations != null)
            {
                writer.WriteInt(PluginConfigurations.Count);

                foreach (var cachePlugin in PluginConfigurations)
                {
                    if (cachePlugin == null)
                    {
                        throw new InvalidOperationException("Invalid cache configuration: " +
                                                            "ICachePluginConfiguration can't be null.");
                    }

                    if (cachePlugin.CachePluginConfigurationClosureFactoryId != null)
                    {
                        writer.WriteBoolean(true);
                        writer.WriteInt(cachePlugin.CachePluginConfigurationClosureFactoryId.Value);
                        cachePlugin.WriteBinary(writer);
                    }
                    else
                    {
                        if (!cachePlugin.GetType().IsSerializable)
                        {
                            throw new InvalidOperationException("Invalid cache configuration: " +
                                                                "ICachePluginConfiguration should be Serializable.");
                        }

                        writer.WriteBoolean(false);
                        writer.WriteObject(cachePlugin);
                    }
                }
            }
            else
            {
                writer.WriteInt(0);
            }
        }
Example #20
0
        /// <summary>
        /// Writes this instance.
        /// </summary>
        internal void Write(IBinaryRawWriter writer)
        {
            writer.WriteString(KeyTypeName);
            writer.WriteString(ValueTypeName);

            if (Fields != null)
            {
                writer.WriteInt(Fields.Count);

                foreach (var field in Fields)
                {
                    writer.WriteString(field.Name);
                    writer.WriteString(field.FieldTypeName);
                }
            }
            else
                writer.WriteInt(0);

            if (Aliases != null)
            {
                writer.WriteInt(Aliases.Count);

                foreach (var queryAlias in Aliases)
                {
                    writer.WriteString(queryAlias.FullName);
                    writer.WriteString(queryAlias.Alias);
                }
            }
            else
                writer.WriteInt(0);

            if (Indexes != null)
            {
                writer.WriteInt(Indexes.Count);

                foreach (var index in Indexes)
                {
                    if (index == null)
                        throw new InvalidOperationException("Invalid cache configuration: QueryIndex can't be null.");

                    index.Write(writer);
                }
            }
            else
                writer.WriteInt(0);
        }
Example #21
0
        /// <summary>
        /// Writes this instance to the specified writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="srvVer">Server version.</param>
        internal void Write(IBinaryRawWriter writer, ClientProtocolVersion srvVer)
        {
            Debug.Assert(writer != null);

            writer.WriteString(StoragePath);
            writer.WriteTimeSpanAsLong(CheckpointFrequency);
            writer.WriteInt(CheckpointThreads);
            writer.WriteTimeSpanAsLong(LockWaitTime);
            writer.WriteInt(WalHistorySize);
            writer.WriteInt(WalSegments);
            writer.WriteInt(WalSegmentSize);
            writer.WriteString(WalPath);
            writer.WriteString(WalArchivePath);
            writer.WriteInt((int)WalMode);
            writer.WriteInt(WalThreadLocalBufferSize);
            writer.WriteTimeSpanAsLong(WalFlushFrequency);
            writer.WriteLong(WalFsyncDelayNanos);
            writer.WriteInt(WalRecordIteratorBufferSize);
            writer.WriteBoolean(AlwaysWriteFullPages);
            writer.WriteBoolean(MetricsEnabled);
            writer.WriteInt(MetricsSubIntervalCount);
            writer.WriteTimeSpanAsLong(MetricsRateTimeInterval);
            writer.WriteInt((int)CheckpointWriteOrder);
            writer.WriteBoolean(WriteThrottlingEnabled);
            writer.WriteBoolean(WalCompactionEnabled);
            writer.WriteLong(MaxWalArchiveSize);

            writer.WriteLong(SystemRegionInitialSize);
            writer.WriteLong(SystemRegionMaxSize);
            writer.WriteInt(PageSize);
            writer.WriteInt(ConcurrencyLevel);
            writer.WriteTimeSpanAsLong(WalAutoArchiveAfterInactivity);
            writer.WriteTimeSpanAsLongNullable(CheckpointReadLockTimeout);
            writer.WriteInt((int)WalPageCompression);
            writer.WriteIntNullable(WalPageCompressionLevel);

            if (DataRegionConfigurations != null)
            {
                writer.WriteInt(DataRegionConfigurations.Count);

                foreach (var region in DataRegionConfigurations)
                {
                    if (region == null)
                    {
                        throw new IgniteException(
                                  "DataStorageConfiguration.DataRegionConfigurations must not contain null items.");
                    }

                    region.Write(writer, srvVer);
                }
            }
            else
            {
                writer.WriteInt(0);
            }

            if (DefaultDataRegionConfiguration != null)
            {
                writer.WriteBoolean(true);
                DefaultDataRegionConfiguration.Write(writer, srvVer);
            }
            else
            {
                writer.WriteBoolean(false);
            }
        }
Example #22
0
 /** <inheritdoc /> */
 public void WriteBinary(IBinaryRawWriter writer)
 {
     writer.WriteString(PluginProperty);
 }
Example #23
0
 /// <summary>
 /// Writes to the specified writer.
 /// </summary>
 internal void Write(IBinaryRawWriter writer)
 {
     writer.WriteString(KeyTypeName);
     writer.WriteString(ValueTypeName);
     writer.WriteBoolean(KeepBinary);
 }
Example #24
0
        /// <summary>
        /// Writes this instane to the specified writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal void Write(IBinaryRawWriter writer)
        {
            writer.WriteInt((int)AtomicityMode);
            writer.WriteInt((int)AtomicWriteOrderMode);
            writer.WriteInt(Backups);
            writer.WriteInt((int)CacheMode);
            writer.WriteBoolean(CopyOnRead);
            writer.WriteBoolean(EagerTtl);
            writer.WriteBoolean(EnableSwap);
            writer.WriteBoolean(EvictSynchronized);
            writer.WriteInt(EvictSynchronizedConcurrencyLevel);
            writer.WriteInt(EvictSynchronizedKeyBufferSize);
            writer.WriteLong((long)EvictSynchronizedTimeout.TotalMilliseconds);
            writer.WriteBoolean(Invalidate);
            writer.WriteBoolean(KeepBinaryInStore);
            writer.WriteBoolean(LoadPreviousValue);
            writer.WriteLong((long)LockTimeout.TotalMilliseconds);
            writer.WriteLong((long)LongQueryWarningTimeout.TotalMilliseconds);
            writer.WriteInt(MaxConcurrentAsyncOperations);
            writer.WriteFloat(MaxEvictionOverflowRatio);
            writer.WriteInt((int)MemoryMode);
            writer.WriteString(Name);
            writer.WriteLong(OffHeapMaxMemory);
            writer.WriteBoolean(ReadFromBackup);
            writer.WriteInt(RebalanceBatchSize);
            writer.WriteLong((long)RebalanceDelay.TotalMilliseconds);
            writer.WriteInt((int)RebalanceMode);
            writer.WriteLong((long)RebalanceThrottle.TotalMilliseconds);
            writer.WriteLong((long)RebalanceTimeout.TotalMilliseconds);
            writer.WriteBoolean(SqlEscapeAll);
            writer.WriteInt(SqlOnheapRowCacheSize);
            writer.WriteInt(StartSize);
            writer.WriteInt(WriteBehindBatchSize);
            writer.WriteBoolean(WriteBehindEnabled);
            writer.WriteLong((long)WriteBehindFlushFrequency.TotalMilliseconds);
            writer.WriteInt(WriteBehindFlushSize);
            writer.WriteInt(WriteBehindFlushThreadCount);
            writer.WriteInt((int)WriteSynchronizationMode);
            writer.WriteBoolean(ReadThrough);
            writer.WriteBoolean(WriteThrough);
            writer.WriteObject(CacheStoreFactory);

            if (QueryEntities != null)
            {
                writer.WriteInt(QueryEntities.Count);

                foreach (var entity in QueryEntities)
                {
                    if (entity == null)
                    {
                        throw new InvalidOperationException("Invalid cache configuration: QueryEntity can't be null.");
                    }

                    entity.Write(writer);
                }
            }
            else
            {
                writer.WriteInt(0);
            }
        }
Example #25
0
        /// <summary>
        /// Writes this instance to the specified writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal void Write(IBinaryRawWriter writer)
        {
            // Make sure system marshaller is used.
            Debug.Assert(((BinaryWriter)writer).Marshaller == BinaryUtils.Marshaller);

            writer.WriteInt((int)AtomicityMode);
            writer.WriteInt(Backups);
            writer.WriteInt((int)CacheMode);
            writer.WriteBoolean(CopyOnRead);
            writer.WriteBoolean(EagerTtl);
            writer.WriteBoolean(Invalidate);
            writer.WriteBoolean(KeepBinaryInStore);
            writer.WriteBoolean(LoadPreviousValue);
            writer.WriteLong((long)LockTimeout.TotalMilliseconds);
            writer.WriteLong((long)LongQueryWarningTimeout.TotalMilliseconds);
            writer.WriteInt(MaxConcurrentAsyncOperations);
            writer.WriteString(Name);
            writer.WriteBoolean(ReadFromBackup);
            writer.WriteInt(RebalanceBatchSize);
            writer.WriteLong((long)RebalanceDelay.TotalMilliseconds);
            writer.WriteInt((int)RebalanceMode);
            writer.WriteLong((long)RebalanceThrottle.TotalMilliseconds);
            writer.WriteLong((long)RebalanceTimeout.TotalMilliseconds);
            writer.WriteBoolean(SqlEscapeAll);
            writer.WriteInt(StartSize);
            writer.WriteInt(WriteBehindBatchSize);
            writer.WriteBoolean(WriteBehindEnabled);
            writer.WriteLong((long)WriteBehindFlushFrequency.TotalMilliseconds);
            writer.WriteInt(WriteBehindFlushSize);
            writer.WriteInt(WriteBehindFlushThreadCount);
            writer.WriteBoolean(WriteBehindCoalescing);
            writer.WriteInt((int)WriteSynchronizationMode);
            writer.WriteBoolean(ReadThrough);
            writer.WriteBoolean(WriteThrough);
            writer.WriteBoolean(EnableStatistics);
            writer.WriteString(MemoryPolicyName);
            writer.WriteInt((int)PartitionLossPolicy);
            writer.WriteObject(CacheStoreFactory);

            if (QueryEntities != null)
            {
                writer.WriteInt(QueryEntities.Count);

                foreach (var entity in QueryEntities)
                {
                    if (entity == null)
                    {
                        throw new InvalidOperationException("Invalid cache configuration: QueryEntity can't be null.");
                    }

                    entity.Write(writer);
                }
            }
            else
            {
                writer.WriteInt(0);
            }

            if (NearConfiguration != null)
            {
                writer.WriteBoolean(true);
                NearConfiguration.Write(writer);
            }
            else
            {
                writer.WriteBoolean(false);
            }

            EvictionPolicyBase.Write(writer, EvictionPolicy);
            AffinityFunctionSerializer.Write(writer, AffinityFunction);
            ExpiryPolicySerializer.WritePolicyFactory(writer, ExpiryPolicyFactory);

            if (PluginConfigurations != null)
            {
                writer.WriteInt(PluginConfigurations.Count);

                foreach (var cachePlugin in PluginConfigurations)
                {
                    if (cachePlugin == null)
                    {
                        throw new InvalidOperationException("Invalid cache configuration: " +
                                                            "ICachePluginConfiguration can't be null.");
                    }

                    if (cachePlugin.CachePluginConfigurationClosureFactoryId != null)
                    {
                        writer.WriteBoolean(true);
                        writer.WriteInt(cachePlugin.CachePluginConfigurationClosureFactoryId.Value);
                        cachePlugin.WriteBinary(writer);
                    }
                    else
                    {
                        writer.WriteBoolean(false);
                        writer.WriteObject(cachePlugin);
                    }
                }
            }
            else
            {
                writer.WriteInt(0);
            }
        }
Example #26
0
        /// <summary>
        /// Writes the key.
        /// </summary>
        private static void WriteKey(DbCacheKey key, IBinaryRawWriter writer, bool includeNames)
        {
            writer.WriteString(key.Key);

            if (key.EntitySetVersions != null)
            {
                writer.WriteInt(key.EntitySetVersions.Count);

                // Versions should be in the same order, so we can't iterate over the dictionary.
                foreach (var entitySet in key.EntitySets)
                {
                    writer.WriteLong(key.EntitySetVersions[entitySet.Name]);

                    if (includeNames)
                        writer.WriteString(entitySet.Name);
                }
            }
            else
            {
                writer.WriteInt(-1);
            }
        }
        /** <inheritdoc /> */
        internal override void Write(IBinaryRawWriter writer)
        {
            base.Write(writer);

            var eps = Endpoints;

            if (eps != null)
            {
                writer.WriteInt(eps.Count);

                foreach (var ep in eps)
                    writer.WriteString(ep);
            }
            else
                writer.WriteInt(0);
        }
 /** <inheritDoc /> */
 public void Write(IBinaryRawWriter writer)
 {
     writer.WriteShort(Attribute);
     writer.WriteString(_key);
     writer.WriteString(_value);
 }
Example #29
0
 /// <summary>
 /// Writes this object to the given writer.
 /// </summary>
 void IBinaryRawWriteAware <IBinaryRawWriter> .Write(IBinaryRawWriter writer)
 {
     writer.WriteString(TypeName);
     writer.WriteString(AffinityKeyFieldName);
 }
 /// <summary>
 /// Writes this instance to the specified writer.
 /// </summary>
 internal void Write(IBinaryRawWriter writer)
 {
     writer.WriteInt(AckSendThreshold);
     writer.WriteLong((long) ConnectTimeout.TotalMilliseconds);
     writer.WriteBoolean(DirectBuffer);
     writer.WriteBoolean(DirectSendBuffer);
     writer.WriteLong((long) IdleConnectionTimeout.TotalMilliseconds);
     writer.WriteString(LocalAddress);
     writer.WriteInt(LocalPort);
     writer.WriteInt(LocalPortRange);
     writer.WriteLong((long) MaxConnectTimeout.TotalMilliseconds);
     writer.WriteInt(MessageQueueLimit);
     writer.WriteInt(ReconnectCount);
     writer.WriteInt(SelectorsCount);
     writer.WriteInt(SlowClientQueueLimit);
     writer.WriteInt(SocketReceiveBufferSize);
     writer.WriteInt(SocketSendBufferSize);
     writer.WriteBoolean(TcpNoDelay);
     writer.WriteInt(UnacknowledgedMessagesBufferSize);
 }
Example #31
0
        public override void InternalToBinary(IBinaryRawWriter writer)
        {
            VersionSerializationHelper.EmitVersionByte(writer, VERSION_NUMBER);

            writer.WriteString(MessageTopicName);
        }