My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package org.wyki.cassandra.pelops;

import org.apache.cassandra.thrift.ColumnPath;
import org.apache.cassandra.thrift.ConsistencyLevel;
import org.wyki.cassandra.pelops.ThriftPool.Connection;

/**
* Facilitates the removal of data at a key-level.
*
* @author dominicwilliams
*
*/
public class KeyDeletor extends KeyspaceOperand {

private final long timestamp;

/**
* Delete all rows with the specified key (that is, for each column family, remove any row that has the
* specified key, such that the database no longer stores any data for the key).
* @param rowKey The key of the rows to be deleted
* @param cLevel The Cassandra consistency level to be used
* @throws Exception
public void deleteKey(final String rowKey, final ConsistencyLevel cLevel) throws Exception {
IOperation operation = new IOperation() {
@Override
public Object execute(Connection conn) throws Exception {

ColumnPath path = new ColumnPath();
conn.getAPI().remove(keyspace, rowKey, path, timestamp, cLevel);
return null;
}
};
tryOperation(operation);
throw new NotImplementedException();
}
*/

/**
* Delete a row with a specified key from a specified column family. The function succeeds even if
* the row does not exist.
* @param rowKey The key of the row
* @param columnFamily The column family from which to delete the row
* @param cLevel The Cassandra consistency level to be used
* @throws Exception
*/
public void deleteRow(final String rowKey, final String columnFamily, final ConsistencyLevel cLevel) throws Exception {
IOperation operation = new IOperation() {
@Override
public Object execute(Connection conn) throws Exception {

ColumnPath path = new ColumnPath(columnFamily);
conn.getAPI().remove(keyspace, rowKey, path, timestamp, cLevel);
return null;
}
};
tryOperation(operation);
}

protected KeyDeletor(ThriftPool thrift, String keyspace) {
this(thrift, keyspace, System.currentTimeMillis() * 1000);
}

protected KeyDeletor(ThriftPool thrift, String keyspace, long timestamp) {
super(thrift, keyspace);
this.timestamp = timestamp;
}
}

Change log

r7 by thedwilliams on Jun 23, 2010   Diff
[No log message]
Go to: 
Project members, sign in to write a code review

Older revisions

r5 by thedwilliams on Jun 23, 2010   Diff
[No log message]
r2 by thedwilliams on Jun 8, 2010   Diff
[No log message]
All revisions of this file

File info

Size: 2148 bytes, 67 lines
Powered by Google Project Hosting