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
68
69
70
71
72
73
74
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.appengine.tools.mapreduce;

import com.google.appengine.api.blobstore.BlobKey;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;

/**
* A key for mapreduce mapper over Blobstore.
*
*/
public final class BlobstoreRecordKey {

private final BlobKey blobKey;
private final long offset;

BlobstoreRecordKey(BlobKey blobKey, long offset) {
Preconditions.checkNotNull(blobKey);
Preconditions.checkArgument(offset >= 0);
this.blobKey = blobKey;
this.offset = offset;
}

public BlobKey getBlobKey() {
return blobKey;
}

public long getOffset() {
return offset;
}

@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (other == null || getClass() != other.getClass()) {
return false;
}
BlobstoreRecordKey that = (BlobstoreRecordKey) other;

return offset == that.offset && blobKey.equals(that.blobKey);
}

@Override
public int hashCode() {
return Objects.hashCode(blobKey, offset);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("BlobstoreRecordKey");
sb.append("{blobKey=").append(blobKey);
sb.append(", offset=").append(offset);
sb.append('}');
return sb.toString();
}
}

Change log

r207 by mike.aizatsky on Jul 15, 2011   Diff
Due to some problems this CL includes more
than one change:

- MapReduceServlet has got some protection
against taskqueue executed the same
  task more than once (yes, it can happen)
- Added some code which was not exported
before
- Lots of whitespace and author tag
changes due to some internal tool changes.


Go to: 
Project members, sign in to write a code review

Older revisions

r86 by frewstore on Jul 29, 2010   Diff
Add Blobstore record reading for Java
All revisions of this file

File info

Size: 1915 bytes, 74 lines
Powered by Google Project Hosting