Exemplo n.º 1
0
        /// <summary>
        /// Converts this instance to full <see cref="CacheConfiguration"/>.
        /// </summary>
        public CacheConfiguration ToCacheConfiguration()
        {
            var cfg = new CacheConfiguration();

            ClientCacheConfigurationSerializer.Copy(this, cfg);

            return(cfg);
        }
Exemplo n.º 2
0
        /** <inheritDoc /> */
        public ICacheClient <TK, TV> CreateCache <TK, TV>(CacheClientConfiguration configuration)
        {
            IgniteArgumentCheck.NotNull(configuration, "configuration");

            DoOutOp(ClientOp.CacheCreateWithConfiguration,
                    w => ClientCacheConfigurationSerializer.Write(w.Stream, configuration, ServerVersion()));

            return(GetCache <TK, TV>(configuration.Name));
        }
 /// <summary>
 /// Serializes and deserializes the config.
 /// </summary>
 private static CacheClientConfiguration SerializeDeserialize(CacheClientConfiguration cfg)
 {
     using (var stream = new BinaryHeapStream(128))
     {
         ClientCacheConfigurationSerializer.Write(stream, cfg, ClientSocket.CurrentProtocolVersion, true);
         stream.Seek(0, SeekOrigin.Begin);
         return(new CacheClientConfiguration(stream, ClientSocket.CurrentProtocolVersion));
     }
 }
Exemplo n.º 4
0
        /** <inheritDoc /> */
        public ICacheClient <TK, TV> GetOrCreateCache <TK, TV>(CacheClientConfiguration configuration)
        {
            IgniteArgumentCheck.NotNull(configuration, "configuration");

            DoOutOp(ClientOp.CacheGetOrCreateWithConfiguration,
                    ctx => ClientCacheConfigurationSerializer.Write(ctx.Stream, configuration, ctx.ProtocolVersion));

            return(GetCache <TK, TV>(configuration.Name));
        }
 /// <summary>
 /// Serializes and deserializes the config.
 /// </summary>
 private static CacheClientConfiguration SerializeDeserialize(CacheClientConfiguration cfg)
 {
     using (var stream = new BinaryHeapStream(128))
     {
         ClientCacheConfigurationSerializer.Write(stream, cfg);
         stream.Seek(0, SeekOrigin.Begin);
         return(new CacheClientConfiguration(stream));
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheConfiguration"/> class,
        /// performing a deep copy of specified cache configuration.
        /// </summary>
        /// <param name="other">The other configuration to perfrom deep copy from.</param>
        public CacheClientConfiguration(CacheClientConfiguration other)
        {
            if (other != null)
            {
                using (var stream = IgniteManager.Memory.Allocate().GetStream())
                {
                    ClientCacheConfigurationSerializer.Write(stream, other, ClientSocket.CurrentProtocolVersion, true);

                    stream.SynchronizeOutput();
                    stream.Seek(0, SeekOrigin.Begin);

                    ClientCacheConfigurationSerializer.Read(stream, this, ClientSocket.CurrentProtocolVersion);
                }

                CopyLocalProperties(other);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheClientConfiguration"/> class.
        /// </summary>
        internal CacheClientConfiguration(IBinaryStream stream, ClientProtocolVersion srvVer)
        {
            Debug.Assert(stream != null);

            ClientCacheConfigurationSerializer.Read(stream, this, srvVer);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheClientConfiguration" /> class, copying properties from
        /// provided server cache configuration. See also <see cref="ToCacheConfiguration"/>.
        /// </summary>
        /// <param name="cacheConfiguration">Server cache configuration.</param>
        /// <param name="ignoreUnsupportedProperties">If set to <c>true</c>,
        /// ignores unsupported properties instead of throwing an exception.</param>
        public CacheClientConfiguration(CacheConfiguration cacheConfiguration, bool ignoreUnsupportedProperties)
        {
            IgniteArgumentCheck.NotNull(cacheConfiguration, "cacheConfiguration");

            ClientCacheConfigurationSerializer.Copy(cacheConfiguration, this, ignoreUnsupportedProperties);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheClientConfiguration"/> class.
        /// </summary>
        internal CacheClientConfiguration(IBinaryStream stream)
        {
            Debug.Assert(stream != null);

            ClientCacheConfigurationSerializer.Read(stream, this);
        }