@Test public void saveUnacknowledged() { final RedisDataStore store = newRedisDataStore(); final Channel channel = newChannel2(); store.saveChannel(channel); store.saveUnacknowledged(channel.getChannelId(), channel.getVersion()); final Set<Ack> unacknowledged = store.getUnacknowledged(channel.getUAID()); assertThat(unacknowledged.size(), is(1)); }
@Override public String saveUnacknowledged(final String channelId, final long version) { final Jedis jedis = jedisPool.getResource(); try { jedis.set(ackLookupKey(channelId), Long.toString(version)); final List<String> hashValues = jedis.hmget(chidLookupKey(channelId), UAID_KEY); final String uaid = hashValues.get(0); jedis.sadd(acksLookupKey(uaid), channelId); return uaid; } finally { jedisPool.returnResource(jedis); } }
RedisDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) { final Jedis jedis = jedisPool.getResource(); try { jedis.set(ackLookupKey(channelId), Long.toString(version)); final List<String> hashValues = jedis.hmget(chidLookupKey(channelId), UAID_KEY); final String uaid = hashValues.get(0); jedis.sadd(acksLookupKey(uaid), channelId); return uaid; } finally { jedisPool.returnResource(jedis); } } }
RedisDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) { final Jedis jedis = jedisPool.getResource(); try { jedis.set(ackLookupKey(channelId), Long.toString(version)); final List<String> hashValues = jedis.hmget(chidLookupKey(channelId), UAID_KEY); final String uaid = hashValues.get(0); jedis.sadd(acksLookupKey(uaid), channelId); return uaid; } finally { jedisPool.returnResource(jedis); } } RedisDataStore(final String host, final int port); }
RedisDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) { final Jedis jedis = jedisPool.getResource(); try { jedis.set(ackLookupKey(channelId), Long.toString(version)); final List<String> hashValues = jedis.hmget(chidLookupKey(channelId), UAID_KEY); final String uaid = hashValues.get(0); jedis.sadd(acksLookupKey(uaid), channelId); return uaid; } finally { jedisPool.returnResource(jedis); } } RedisDataStore(final String host, final int port); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @Override boolean saveChannel(final Channel channel); @Override void removeChannels(final Set<String> channelIds); @Override Channel getChannel(final String channelId); @Override Set<String> getChannelIds(final String uaid); @Override void removeChannels(final String uaid); @Override String updateVersion(final String endpointToken, final long newVersion); @Override String saveUnacknowledged(final String channelId, final long version); @Override Set<Ack> getUnacknowledged(final String uaid); @Override Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acks); }
RedisDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) { final Jedis jedis = jedisPool.getResource(); try { jedis.set(ackLookupKey(channelId), Long.toString(version)); final List<String> hashValues = jedis.hmget(chidLookupKey(channelId), UAID_KEY); final String uaid = hashValues.get(0); jedis.sadd(acksLookupKey(uaid), channelId); return uaid; } finally { jedisPool.returnResource(jedis); } } RedisDataStore(final String host, final int port); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @Override boolean saveChannel(final Channel channel); @Override void removeChannels(final Set<String> channelIds); @Override Channel getChannel(final String channelId); @Override Set<String> getChannelIds(final String uaid); @Override void removeChannels(final String uaid); @Override String updateVersion(final String endpointToken, final long newVersion); @Override String saveUnacknowledged(final String channelId, final long version); @Override Set<Ack> getUnacknowledged(final String uaid); @Override Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acks);  }