Exemplo n.º 1
0
        public static RequestFormat newRequestFormat(RequestFormatType type)
        {
            RequestFormat format = null;

            switch (type)
            {
                case RequestFormatType.VOLDEMORT:
                    format = new VoldemortNativeRequestFormat();
                    break;
                case RequestFormatType.PROTOCOL_BUFFERS:
                    format = new ProtocolBuffersRequestFormat();
                    break;
                case RequestFormatType.ADMIN_HANDLER:
                    format = new AdminHandlerRequestFormat();
                    break;
                default:
                    break;

            }

            if(null==format)
                throw new VoldemortException("Request format type not implemented " + type);


            return format;
        }
 protected override Store getStore(string storeName, string host, int port, RequestFormatType type, bool shouldReRoute)
 {
     return new SocketStore(storeName,
                host,
                port,
                this.ClientConfig,
                _ConnPool,
                type,
                shouldReRoute);
 }
Exemplo n.º 3
0
        public SocketStore(string storeName,
                       string host,
                       int port,
                       ClientConfig config,
                       ConnectionPool connPool,
                       RequestFormatType type,
                       bool shouldReroute)
        {
            if (string.IsNullOrEmpty(storeName)) throw new ArgumentNullException("storeName", "storeName cannot be null.");
            if (string.IsNullOrEmpty(host)) throw new ArgumentNullException("host", "host cannot be null.");
            if (null == config) throw new ArgumentNullException("config", "config cannot be null.");
            if (null == connPool) throw new ArgumentNullException("connPool", "connPool cannot be null.");
            
            this.Name = storeName;
            this.Host = host;
            this.Port = port;
            this.Config = config;
            this.Pool = connPool;
            this.Type = type;
            this.ShouldReroute = shouldReroute;

            this.request = RequestFormat.newRequestFormat(type);
        }
        //private Versioned bootstrapMetadata(byte[] key)
        //{

        //}

        protected override Store<byte[], byte[]> GetStore(string storeName, string host, int port, RequestFormatType type)
        {
            throw new NotImplementedException();
        }