GitHub PullRequestReviewCommentEvent at 2014-05-14 10:54:47
Repository: elasticsearch
Actor: jpountz
Payload: {"comment":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/comments/12630267","id":12630267,"diff_hunk":"@@ -32,11 +35,34 @@\n /** Utility class to resolve the Lucene doc ID and version for a given uid. */\n public class Versions {\n \n-    public static final long MATCH_ANY = 0L; // Version was not specified by the user\n+    public static final long MATCH_ANY = -3L; // Version was not specified by the user\n+    // the value for MATCH_ANY before ES 1.2.0 - will be removed\n+    public static final long MATCH_ANY_PRE_1_2_0 = 0L;\n     public static final long NOT_FOUND = -1L;\n     public static final long NOT_SET = -2L;\n \n-    private Versions() {}\n+    // The minimum possible for a version value. This is needed to serialize version as positive vLong.\n+    private static final long MIN_VALID_VALUE = -3L;\n+\n+\n+    public static void writeAsVLong(long version, StreamOutput out) throws IOException {\n+        if (out.getVersion().onOrAfter(Version.V_1_2_0)) {\n+            out.writeVLong(version - Versions.MIN_VALID_VALUE);\n+        } else {\n+            out.writeVLong(version);\n+        }\n+    }","path":"src/main/java/org/elasticsearch/common/lucene/uid/Versions.java","position":33,"original_position":33,"commit_id":"7ddab02a7bbe088271d2479c24467f6891f95753","original_commit_id":"7ddab02a7bbe088271d2479c24467f6891f95753","user":{"login":"jpountz","id":299848,"avatar_url":"https://avatars.githubusercontent.com/u/299848?","gravatar_id":"e0ad83ea7b832220d0a3231e529f4338","url":"https://api.github.com/users/jpountz","html_url":"https://github.com/jpountz","followers_url":"https://api.github.com/users/jpountz/followers","following_url":"https://api.github.com/users/jpountz/following{/other_user}","gists_url":"https://api.github.com/users/jpountz/gists{/gist_id}","starred_url":"https://api.github.com/users/jpountz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpountz/subscriptions","organizations_url":"https://api.github.com/users/jpountz/orgs","repos_url":"https://api.github.com/users/jpountz/repos","events_url":"https://api.github.com/users/jpountz/events{/privacy}","received_events_url":"https://api.github.com/users/jpountz/received_events","type":"User","site_admin":false},"body":"Should it use writeLong instead to be more future-proof (like UpdateRequest and IndexRequest do) eg. if we need a new special negative value?","created_at":"2014-05-14T10:54:47Z","updated_at":"2014-05-14T10:54:47Z","html_url":"https://github.com/elasticsearch/elasticsearch/pull/6149#discussion_r12630267","pull_request_url":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/6149","_links":{"self":{"href":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/comments/12630267"},"html":{"href":"https://github.com/elasticsearch/elasticsearch/pull/6149#discussion_r12630267"},"pull_request":{"href":"https://api.github.com/repos/elasticsearch/elasticsearch/pulls/6149"}}}}