Repository: incubator-impala
Updated Branches:
  refs/heads/master d06225746 -> bd6d2df73


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d6abb29d/be/src/kudu/util/url-coding.h
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/url-coding.h b/be/src/kudu/util/url-coding.h
new file mode 100644
index 0000000..179aecb
--- /dev/null
+++ b/be/src/kudu/util/url-coding.h
@@ -0,0 +1,70 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+#ifndef UTIL_URL_CODING_H
+#define UTIL_URL_CODING_H
+
+#include <stdint.h>
+
+#include <iosfwd>
+#include <string>
+#include <vector>
+
+namespace kudu {
+
+// Utility method to URL-encode a string (that is, replace special
+// characters with %<hex value in ascii>).
+// The optional parameter hive_compat controls whether we mimic Hive's
+// behaviour when encoding a string, which is only to encode certain
+// characters (excluding, e.g., ' ')
+void UrlEncode(const std::string& in, std::string* out, bool hive_compat = 
false);
+void UrlEncode(const std::vector<uint8_t>& in, std::string* out,
+    bool hive_compat = false);
+std::string UrlEncodeToString(const std::string& in, bool hive_compat = false);
+
+// Utility method to decode a string that was URL-encoded. Returns
+// true unless the string could not be correctly decoded.
+// The optional parameter hive_compat controls whether or not we treat
+// the strings as encoded by Hive, which means selectively ignoring
+// certain characters like ' '.
+bool UrlDecode(const std::string& in, std::string* out, bool hive_compat = 
false);
+
+// Utility method to encode input as base-64 encoded.  This is not
+// very performant (multiple string copies) and should not be used
+// in a hot path.
+void Base64Encode(const std::vector<uint8_t>& in, std::string* out);
+void Base64Encode(const std::vector<uint8_t>& in, std::ostringstream* out);
+void Base64Encode(const std::string& in, std::string* out);
+void Base64Encode(const std::string& in, std::ostringstream* out);
+
+// Utility method to decode base64 encoded strings.  Also not extremely
+// performant.
+// Returns true unless the string could not be correctly decoded.
+bool Base64Decode(const std::string& in, std::string* out);
+
+// Replaces &, < and > with &amp;, &lt; and &gt; respectively. This is
+// not the full set of required encodings, but one that should be
+// added to on a case-by-case basis. Slow, since it necessarily
+// inspects each character in turn, and copies them all to *out; use
+// judiciously.
+void EscapeForHtml(const std::string& in, std::ostringstream* out);
+
+// Same as above, but returns a string.
+std::string EscapeForHtmlToString(const std::string& in);
+
+} // namespace kudu
+
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d6abb29d/be/src/kudu/util/user-test.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/user-test.cc b/be/src/kudu/util/user-test.cc
new file mode 100644
index 0000000..8dfbe14
--- /dev/null
+++ b/be/src/kudu/util/user-test.cc
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+#include <string>
+
+#include <gtest/gtest.h>
+
+#include "kudu/util/status.h"
+#include "kudu/util/test_util.h"
+#include "kudu/util/user.h"
+
+namespace kudu {
+
+using std::string;
+
+class TestUser : public KuduTest {
+};
+
+// Validate that the current username is non-empty.
+TEST_F(TestUser, TestNonEmpty) {
+  string username;
+  ASSERT_TRUE(username.empty());
+  ASSERT_OK(GetLoggedInUser(&username));
+  ASSERT_FALSE(username.empty());
+  LOG(INFO) << "Name of the current user is: " << username;
+}
+
+} // namespace kudu

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d6abb29d/be/src/kudu/util/user.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/user.cc b/be/src/kudu/util/user.cc
new file mode 100644
index 0000000..c8a2868
--- /dev/null
+++ b/be/src/kudu/util/user.cc
@@ -0,0 +1,68 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+#include "kudu/util/user.h"
+
+#include <sys/types.h>
+#include <errno.h>
+#include <pwd.h>
+#include <unistd.h>
+
+#include <string>
+
+#include <glog/logging.h>
+
+#include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/util/errno.h"
+#include "kudu/util/status.h"
+
+using std::string;
+
+namespace kudu {
+
+Status GetLoggedInUser(string* user_name) {
+  DCHECK(user_name != nullptr);
+
+  struct passwd pwd;
+  struct passwd *result;
+
+  size_t bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
+  if (bufsize == -1) {  // Value was indeterminate.
+    bufsize = 16384;    // Should be more than enough, per the man page.
+  }
+
+  gscoped_ptr<char[], FreeDeleter> buf(static_cast<char *>(malloc(bufsize)));
+  if (buf.get() == nullptr) {
+    return Status::RuntimeError("Malloc failed", ErrnoToString(errno), errno);
+  }
+
+  int ret = getpwuid_r(getuid(), &pwd, buf.get(), bufsize, &result);
+  if (result == nullptr) {
+    if (ret == 0) {
+      return Status::NotFound("Current logged-in user not found! This is an 
unexpected error.");
+    } else {
+      // Errno in ret
+      return Status::RuntimeError("Error calling getpwuid_r()", 
ErrnoToString(ret), ret);
+    }
+  }
+
+  *user_name = pwd.pw_name;
+
+  return Status::OK();
+}
+
+} // namespace kudu

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d6abb29d/be/src/kudu/util/user.h
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/user.h b/be/src/kudu/util/user.h
new file mode 100644
index 0000000..6839a81
--- /dev/null
+++ b/be/src/kudu/util/user.h
@@ -0,0 +1,32 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+#ifndef KUDU_UTIL_USER_H
+#define KUDU_UTIL_USER_H
+
+#include <string>
+
+#include "kudu/util/status.h"
+
+namespace kudu {
+
+// Get current logged-in user with getpwuid_r().
+// user name is written to user_name.
+Status GetLoggedInUser(std::string* user_name);
+
+} // namespace kudu
+
+#endif // KUDU_UTIL_USER_H

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d6abb29d/be/src/kudu/util/version_info.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/version_info.cc b/be/src/kudu/util/version_info.cc
new file mode 100644
index 0000000..2ea437f
--- /dev/null
+++ b/be/src/kudu/util/version_info.cc
@@ -0,0 +1,79 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+#include "kudu/util/version_info.h"
+
+#include <string>
+
+#include "kudu/generated/version_defines.h"
+#include "kudu/gutil/strings/substitute.h"
+#include "kudu/util/version_info.pb.h"
+
+using std::string;
+
+namespace kudu {
+
+string VersionInfo::GetGitHash() {
+  string ret = KUDU_GIT_HASH;
+  if (!KUDU_BUILD_CLEAN_REPO) {
+    ret += "-dirty";
+  }
+  return ret;
+}
+
+string VersionInfo::GetShortVersionString() {
+  return strings::Substitute("kudu $0 (rev $1)",
+                             KUDU_VERSION_STRING,
+                             GetGitHash());
+}
+
+string VersionInfo::GetAllVersionInfo() {
+  string ret = strings::Substitute(
+      "kudu $0\n"
+      "revision $1\n"
+      "build type $2\n"
+      "built by $3 at $4 on $5",
+      KUDU_VERSION_STRING,
+      GetGitHash(),
+      KUDU_BUILD_TYPE,
+      KUDU_BUILD_USERNAME,
+      KUDU_BUILD_TIMESTAMP,
+      KUDU_BUILD_HOSTNAME);
+  if (strlen(KUDU_BUILD_ID) > 0) {
+    strings::SubstituteAndAppend(&ret, "\nbuild id $0", KUDU_BUILD_ID);
+  }
+#ifdef ADDRESS_SANITIZER
+  ret += "\nASAN enabled";
+#endif
+#ifdef THREAD_SANITIZER
+  ret += "\nTSAN enabled";
+#endif
+  return ret;
+}
+
+void VersionInfo::GetVersionInfoPB(VersionInfoPB* pb) {
+  pb->set_git_hash(KUDU_GIT_HASH);
+  pb->set_build_hostname(KUDU_BUILD_HOSTNAME);
+  pb->set_build_timestamp(KUDU_BUILD_TIMESTAMP);
+  pb->set_build_username(KUDU_BUILD_USERNAME);
+  pb->set_build_clean_repo(KUDU_BUILD_CLEAN_REPO);
+  pb->set_build_id(KUDU_BUILD_ID);
+  pb->set_build_type(KUDU_BUILD_TYPE);
+  pb->set_version_string(KUDU_VERSION_STRING);
+}
+
+} // namespace kudu

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d6abb29d/be/src/kudu/util/version_info.h
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/version_info.h b/be/src/kudu/util/version_info.h
new file mode 100644
index 0000000..5bda97e
--- /dev/null
+++ b/be/src/kudu/util/version_info.h
@@ -0,0 +1,48 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+#ifndef KUDU_UTIL_VERSION_INFO_H
+#define KUDU_UTIL_VERSION_INFO_H
+
+#include <string>
+
+#include "kudu/gutil/macros.h"
+
+namespace kudu {
+
+class VersionInfoPB;
+
+// Static functions related to fetching information about the current build.
+class VersionInfo {
+ public:
+  // Get a short version string ("kudu 1.2.3 (rev abcdef...)")
+  static std::string GetShortVersionString();
+
+  // Get a multi-line string including version info, build time, etc.
+  static std::string GetAllVersionInfo();
+
+  // Set the version info in 'pb'.
+  static void GetVersionInfoPB(VersionInfoPB* pb);
+ private:
+  // Get the git hash for this build. If the working directory was dirty when
+  // Kudu was built, also appends "-dirty".
+  static std::string GetGitHash();
+
+  DISALLOW_IMPLICIT_CONSTRUCTORS(VersionInfo);
+};
+
+} // namespace kudu
+#endif /* KUDU_UTIL_VERSION_INFO_H */

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d6abb29d/be/src/kudu/util/version_info.proto
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/version_info.proto 
b/be/src/kudu/util/version_info.proto
new file mode 100644
index 0000000..ca82f12
--- /dev/null
+++ b/be/src/kudu/util/version_info.proto
@@ -0,0 +1,32 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+syntax = "proto2";
+package kudu;
+
+option java_package = "org.apache.kudu";
+
+// Information about the build environment, configuration, etc.
+message VersionInfoPB {
+  optional string git_hash = 1;
+  optional string build_hostname = 2;
+  optional string build_timestamp = 3;
+  optional string build_username = 4;
+  optional bool build_clean_repo = 5;
+  optional string build_id = 6;
+  optional string build_type = 7;
+  optional string version_string = 8;
+}

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d6abb29d/be/src/kudu/util/web_callback_registry.h
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/web_callback_registry.h 
b/be/src/kudu/util/web_callback_registry.h
new file mode 100644
index 0000000..ce90d79
--- /dev/null
+++ b/be/src/kudu/util/web_callback_registry.h
@@ -0,0 +1,68 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+#ifndef KUDU_UTIL_WEB_CALLBACK_REGISTRY_H
+#define KUDU_UTIL_WEB_CALLBACK_REGISTRY_H
+
+#include <iosfwd>
+#include <map>
+#include <string>
+
+#include <boost/function.hpp>
+
+namespace kudu {
+
+// Interface for registering webserver callbacks.
+class WebCallbackRegistry {
+ public:
+  typedef std::map<std::string, std::string> ArgumentMap;
+
+  struct WebRequest {
+    // The query string, parsed into key/value argument pairs.
+    ArgumentMap parsed_args;
+
+    // The raw query string passed in the URL. May be empty.
+    std::string query_string;
+
+    // The method (POST/GET/etc).
+    std::string request_method;
+
+    // In the case of a POST, the posted data.
+    std::string post_data;
+  };
+
+  typedef boost::function<void (const WebRequest& args, std::ostringstream* 
output)>
+      PathHandlerCallback;
+
+  virtual ~WebCallbackRegistry() {}
+
+  // Register a callback for a URL path. Path should not include the
+  // http://hostname/ prefix. If is_styled is true, the page is meant to be for
+  // people to look at and is styled.  If false, it is meant to be for 
machines to
+  // scrape.  If is_on_nav_bar is true,  a link to this page is
+  // printed in the navigation bar at the top of each debug page. Otherwise the
+  // link does not appear, and the page is rendered without HTML headers and
+  // footers.
+  // The first registration's choice of is_styled overrides all
+  // subsequent registrations for that URL.
+  virtual void RegisterPathHandler(const std::string& path, const std::string& 
alias,
+                                   const PathHandlerCallback& callback,
+                                   bool is_styled = true, bool is_on_nav_bar = 
true) = 0;
+};
+
+} // namespace kudu
+
+#endif /* KUDU_UTIL_WEB_CALLBACK_REGISTRY_H */

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d6abb29d/be/src/kudu/util/zlib.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/zlib.cc b/be/src/kudu/util/zlib.cc
new file mode 100644
index 0000000..f1a7a49
--- /dev/null
+++ b/be/src/kudu/util/zlib.cc
@@ -0,0 +1,122 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+#include "kudu/util/zlib.h"
+
+#include <zlib.h>
+
+#include <string>
+#include <memory>
+
+#include "kudu/gutil/strings/substitute.h"
+#include "kudu/util/slice.h"
+#include "kudu/util/status.h"
+
+using std::ostream;
+using std::string;
+using std::unique_ptr;
+
+#define ZRETURN_NOT_OK(call) \
+  RETURN_NOT_OK(ZlibResultToStatus(call))
+
+namespace kudu {
+namespace zlib {
+
+namespace  {
+Status ZlibResultToStatus(int rc) {
+  switch (rc) {
+    case Z_OK:
+      return Status::OK();
+    case Z_STREAM_END:
+      return Status::EndOfFile("zlib EOF");
+    case Z_NEED_DICT:
+      return Status::Corruption("zlib error: NEED_DICT");
+    case Z_ERRNO:
+      return Status::IOError("zlib error: Z_ERRNO");
+    case Z_STREAM_ERROR:
+      return Status::Corruption("zlib error: STREAM_ERROR");
+    case Z_DATA_ERROR:
+      return Status::Corruption("zlib error: DATA_ERROR");
+    case Z_MEM_ERROR:
+      return Status::RuntimeError("zlib error: MEM_ERROR");
+    case Z_BUF_ERROR:
+      return Status::RuntimeError("zlib error: BUF_ERROR");
+    case Z_VERSION_ERROR:
+      return Status::RuntimeError("zlib error: VERSION_ERROR");
+    default:
+      return Status::RuntimeError(
+          strings::Substitute("zlib error: unknown error $0", rc));
+  }
+}
+} // anonymous namespace
+
+Status Compress(Slice input, ostream* out) {
+  z_stream zs;
+  memset(&zs, 0, sizeof(zs));
+  ZRETURN_NOT_OK(deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
+                              15 + 16 /* 15 window bits, enable gzip */,
+                              8 /* memory level, max is 9 */,
+                              Z_DEFAULT_STRATEGY));
+
+  zs.avail_in = input.size();
+  zs.next_in = const_cast<uint8_t*>(input.data());
+  const int kChunkSize = 256 * 1024;
+  unique_ptr<unsigned char[]> chunk(new unsigned char[kChunkSize]);
+  int flush;
+  do {
+    zs.avail_out = kChunkSize;
+    zs.next_out = chunk.get();
+    flush = (zs.avail_in == 0) ? Z_FINISH : Z_NO_FLUSH;
+    Status s = ZlibResultToStatus(deflate(&zs, flush));
+    if (!s.ok() && !s.IsEndOfFile()) {
+      return s;
+    }
+    int out_size = zs.next_out - chunk.get();
+    if (out_size > 0) {
+      out->write(reinterpret_cast<char *>(chunk.get()), out_size);
+    }
+  } while (flush != Z_FINISH);
+  ZRETURN_NOT_OK(deflateEnd(&zs));
+  return Status::OK();
+}
+
+Status Uncompress(Slice compressed, std::ostream* out) {
+  z_stream zs;
+  memset(&zs, 0, sizeof(zs));
+  zs.next_in = const_cast<uint8_t*>(compressed.data());
+  zs.avail_in = compressed.size();
+  ZRETURN_NOT_OK(inflateInit2(&zs, 15 + 16 /* 15 window bits, enable zlib */));
+  int flush;
+  Status s;
+  do {
+    unsigned char buf[4096];
+    zs.next_out = buf;
+    zs.avail_out = arraysize(buf);
+    flush = zs.avail_in > 0 ? Z_NO_FLUSH : Z_FINISH;
+    s = ZlibResultToStatus(inflate(&zs, flush));
+    if (!s.ok() && !s.IsEndOfFile()) {
+      return s;
+    }
+    out->write(reinterpret_cast<char *>(buf), zs.next_out - buf);
+  } while (flush == Z_NO_FLUSH);
+  ZRETURN_NOT_OK(inflateEnd(&zs));
+
+  return Status::OK();
+}
+
+} // namespace zlib
+} // namespace kudu

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d6abb29d/be/src/kudu/util/zlib.h
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/zlib.h b/be/src/kudu/util/zlib.h
new file mode 100644
index 0000000..35330fd
--- /dev/null
+++ b/be/src/kudu/util/zlib.h
@@ -0,0 +1,39 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+#pragma once
+
+#include <iosfwd>
+
+#include "kudu/util/slice.h"
+#include "kudu/util/status.h"
+
+namespace kudu {
+namespace zlib {
+
+// Zlib-compress the data in 'input', appending the result to 'out'.
+//
+// In case of an error, some data may still be appended to 'out'.
+Status Compress(Slice input, std::ostream* out);
+
+// Uncompress the zlib-compressed data in 'compressed', appending the result
+// to 'out'.
+//
+// In case of an error, some data may still be appended to 'out'.
+Status Uncompress(Slice compressed, std::ostream* out);
+
+} // namespace zlib
+} // namespace kudu

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d6abb29d/bin/rat_exclude_files.txt
----------------------------------------------------------------------
diff --git a/bin/rat_exclude_files.txt b/bin/rat_exclude_files.txt
index d09270f..cc70bea 100644
--- a/bin/rat_exclude_files.txt
+++ b/bin/rat_exclude_files.txt
@@ -21,6 +21,7 @@ www/index.html
 
 # See LICENSE.txt
 be/src/gutil/*
+be/src/kudu/gutil
 www/highlight/*
 www/DataTables*/*
 www/datatables.*
@@ -37,6 +38,28 @@ www/d3.v3.min.js
 www/jquery/jquery-1.12.4.min.js
 tests/comparison/leopard/static/css/hljs.css
 tests/comparison/leopard/static/js/highlight.pack.js
+be/src/kudu/util/cache-test.cc
+be/src/kudu/util/cache.cc
+be/src/kudu/util/cache.h
+be/src/kudu/util/coding.cc
+be/src/kudu/util/coding.h
+be/src/kudu/util/condition_variable.cc
+be/src/kudu/util/condition_variable.h
+be/src/kudu/util/debug/trace_event.h
+be/src/kudu/util/debug/trace_event_impl.cc
+be/src/kudu/util/debug/trace_event_impl.h
+be/src/kudu/util/debug/trace_event_impl_constants.cc
+be/src/kudu/util/debug/trace_event_synthetic_delay.cc
+be/src/kudu/util/debug/trace_event_synthetic_delay.h
+be/src/kudu/util/env.cc
+be/src/kudu/util/env.h
+be/src/kudu/util/env_posix.cc
+be/src/kudu/util/nvm_cache.cc
+be/src/kudu/util/random.h
+be/src/kudu/util/slice.h
+be/src/kudu/util/status-test.cc
+be/src/kudu/util/status.cc
+be/src/kudu/util/status.h
 
 # http://www.apache.org/legal/src-headers.html: "Short informational text 
files; for
 # example README, INSTALL files. The expectation is that these files make it 
obvious which

Reply via email to