You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by ml...@apache.org on 2016/09/08 02:07:44 UTC
[11/70] [partial] incubator-hawq git commit: HAWQ-959. revert thrift
build commands.
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c
deleted file mode 100644
index ede28cf..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * 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 <assert.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <thrift/c_glib/thrift.h>
-#include <thrift/c_glib/transport/thrift_transport.h>
-#include <thrift/c_glib/transport/thrift_buffered_transport.h>
-
-/* object properties */
-enum _ThriftBufferedTransportProperties
-{
- PROP_0,
- PROP_THRIFT_BUFFERED_TRANSPORT_TRANSPORT,
- PROP_THRIFT_BUFFERED_TRANSPORT_READ_BUFFER_SIZE,
- PROP_THRIFT_BUFFERED_TRANSPORT_WRITE_BUFFER_SIZE
-};
-
-G_DEFINE_TYPE(ThriftBufferedTransport, thrift_buffered_transport, THRIFT_TYPE_TRANSPORT)
-
-/* implements thrift_transport_is_open */
-gboolean
-thrift_buffered_transport_is_open (ThriftTransport *transport)
-{
- ThriftBufferedTransport *t = THRIFT_BUFFERED_TRANSPORT (transport);
- return THRIFT_TRANSPORT_GET_CLASS (t->transport)->is_open (t->transport);
-}
-
-/* overrides thrift_transport_peek */
-gboolean
-thrift_buffered_transport_peek (ThriftTransport *transport, GError **error)
-{
- ThriftBufferedTransport *t = THRIFT_BUFFERED_TRANSPORT (transport);
- return (t->r_buf->len > 0) || thrift_transport_peek (t->transport, error);
-}
-
-/* implements thrift_transport_open */
-gboolean
-thrift_buffered_transport_open (ThriftTransport *transport, GError **error)
-{
- ThriftBufferedTransport *t = THRIFT_BUFFERED_TRANSPORT (transport);
- return THRIFT_TRANSPORT_GET_CLASS (t->transport)->open (t->transport, error);
-}
-
-/* implements thrift_transport_close */
-gboolean
-thrift_buffered_transport_close (ThriftTransport *transport, GError **error)
-{
- ThriftBufferedTransport *t = THRIFT_BUFFERED_TRANSPORT (transport);
- return THRIFT_TRANSPORT_GET_CLASS (t->transport)->close (t->transport, error);
-}
-
-/* the actual read is "slow" because it calls the underlying transport */
-gint32
-thrift_buffered_transport_read_slow (ThriftTransport *transport, gpointer buf,
- guint32 len, GError **error)
-{
- ThriftBufferedTransport *t = THRIFT_BUFFERED_TRANSPORT (transport);
- gint ret = 0;
- guint32 want = len;
- guint32 got = 0;
- guchar *tmpdata = g_alloca (len);
- guint32 have = t->r_buf->len;
-
- /* we shouldn't hit this unless the buffer doesn't have enough to read */
- assert (t->r_buf->len < want);
-
- /* first copy what we have in our buffer. */
- if (have > 0)
- {
- memcpy (buf, t->r_buf, t->r_buf->len);
- want -= t->r_buf->len;
- t->r_buf = g_byte_array_remove_range (t->r_buf, 0, t->r_buf->len);
- }
-
- /* if the buffer is still smaller than what we want to read, then just
- * read it directly. otherwise, fill the buffer and then give out
- * enough to satisfy the read. */
- if (t->r_buf_size < want)
- {
- if ((ret = THRIFT_TRANSPORT_GET_CLASS (t->transport)->read (t->transport,
- tmpdata,
- want,
- error)) < 0) {
- return ret;
- }
- got += ret;
-
- /* copy the data starting from where we left off */
- memcpy ((guint8 *)buf + have, tmpdata, got);
- return got + have;
- } else {
- guint32 give;
-
- if ((ret = THRIFT_TRANSPORT_GET_CLASS (t->transport)->read (t->transport,
- tmpdata,
- want,
- error)) < 0) {
- return ret;
- }
- got += ret;
- t->r_buf = g_byte_array_append (t->r_buf, tmpdata, got);
-
- /* hand over what we have up to what the caller wants */
- give = want < t->r_buf->len ? want : t->r_buf->len;
-
-
- memcpy ((guint8 *)buf + len - want, t->r_buf->data, give);
- t->r_buf = g_byte_array_remove_range (t->r_buf, 0, give);
- want -= give;
-
- return (len - want);
- }
-}
-
-/* implements thrift_transport_read */
-gint32
-thrift_buffered_transport_read (ThriftTransport *transport, gpointer buf,
- guint32 len, GError **error)
-{
- ThriftBufferedTransport *t = THRIFT_BUFFERED_TRANSPORT (transport);
-
- /* if we have enough buffer data to fulfill the read, just use
- * a memcpy */
- if (len <= t->r_buf->len)
- {
- memcpy (buf, t->r_buf->data, len);
- g_byte_array_remove_range (t->r_buf, 0, len);
- return len;
- }
-
- return thrift_buffered_transport_read_slow (transport, buf, len, error);
-}
-
-/* implements thrift_transport_read_end
- * called when write is complete. nothing to do on our end. */
-gboolean
-thrift_buffered_transport_read_end (ThriftTransport *transport, GError **error)
-{
- /* satisfy -Wall */
- THRIFT_UNUSED_VAR (transport);
- THRIFT_UNUSED_VAR (error);
- return TRUE;
-}
-
-gboolean
-thrift_buffered_transport_write_slow (ThriftTransport *transport, gpointer buf,
- guint32 len, GError **error)
-{
- ThriftBufferedTransport *t = THRIFT_BUFFERED_TRANSPORT (transport);
- guint32 have_bytes = t->w_buf->len;
- guint32 space = t->w_buf_size - t->w_buf->len;
-
- /* we need two syscalls because the buffered data plus the buffer itself
- * is too big. */
- if ((have_bytes + len >= 2*t->w_buf_size) || (have_bytes == 0))
- {
- if (have_bytes > 0)
- {
- if (!THRIFT_TRANSPORT_GET_CLASS (t->transport)->write (t->transport,
- t->w_buf->data,
- have_bytes,
- error)) {
- return FALSE;
- }
- t->w_buf = g_byte_array_remove_range (t->w_buf, 0, have_bytes);
- }
- if (!THRIFT_TRANSPORT_GET_CLASS (t->transport)->write (t->transport,
- buf, len, error)) {
- return FALSE;
- }
- return TRUE;
- }
-
- t->w_buf = g_byte_array_append (t->w_buf, buf, space);
- if (!THRIFT_TRANSPORT_GET_CLASS (t->transport)->write (t->transport,
- t->w_buf->data,
- t->w_buf->len,
- error)) {
- return FALSE;
- }
-
- t->w_buf = g_byte_array_remove_range (t->w_buf, 0, t->w_buf->len);
- t->w_buf = g_byte_array_append (t->w_buf, (guint8 *)buf + space, len-space);
-
- return TRUE;
-}
-
-/* implements thrift_transport_write */
-gboolean
-thrift_buffered_transport_write (ThriftTransport *transport,
- const gpointer buf,
- const guint32 len, GError **error)
-{
- ThriftBufferedTransport *t = THRIFT_BUFFERED_TRANSPORT (transport);
-
- /* the length of the current buffer plus the length of the data being read */
- if (t->w_buf->len + len <= t->w_buf_size)
- {
- t->w_buf = g_byte_array_append (t->w_buf, buf, len);
- return len;
- }
-
- return thrift_buffered_transport_write_slow (transport, buf, len, error);
-}
-
-/* implements thrift_transport_write_end
- * called when write is complete. nothing to do on our end. */
-gboolean
-thrift_buffered_transport_write_end (ThriftTransport *transport, GError **error)
-{
- /* satisfy -Wall */
- THRIFT_UNUSED_VAR (transport);
- THRIFT_UNUSED_VAR (error);
- return TRUE;
-}
-
-/* implements thrift_transport_flush */
-gboolean
-thrift_buffered_transport_flush (ThriftTransport *transport, GError **error)
-{
- ThriftBufferedTransport *t = THRIFT_BUFFERED_TRANSPORT (transport);
-
- if (t->w_buf != NULL && t->w_buf->len > 0)
- {
- /* write the buffer and then empty it */
- if (!THRIFT_TRANSPORT_GET_CLASS (t->transport)->write (t->transport,
- t->w_buf->data,
- t->w_buf->len,
- error)) {
- return FALSE;
- }
- t->w_buf = g_byte_array_remove_range (t->w_buf, 0, t->w_buf->len);
- }
- THRIFT_TRANSPORT_GET_CLASS (t->transport)->flush (t->transport,
- error);
-
- return TRUE;
-}
-
-/* initializes the instance */
-static void
-thrift_buffered_transport_init (ThriftBufferedTransport *transport)
-{
- transport->transport = NULL;
- transport->r_buf = g_byte_array_new ();
- transport->w_buf = g_byte_array_new ();
-}
-
-/* destructor */
-static void
-thrift_buffered_transport_finalize (GObject *object)
-{
- ThriftBufferedTransport *transport = THRIFT_BUFFERED_TRANSPORT (object);
-
- if (transport->r_buf != NULL)
- {
- g_byte_array_free (transport->r_buf, TRUE);
- }
- transport->r_buf = NULL;
-
- if (transport->w_buf != NULL)
- {
- g_byte_array_free (transport->w_buf, TRUE);
- }
- transport->w_buf = NULL;
-}
-
-/* property accessor */
-void
-thrift_buffered_transport_get_property (GObject *object, guint property_id,
- GValue *value, GParamSpec *pspec)
-{
- ThriftBufferedTransport *transport = THRIFT_BUFFERED_TRANSPORT (object);
-
- THRIFT_UNUSED_VAR (pspec);
-
- switch (property_id)
- {
- case PROP_THRIFT_BUFFERED_TRANSPORT_TRANSPORT:
- g_value_set_object (value, transport->transport);
- break;
- case PROP_THRIFT_BUFFERED_TRANSPORT_READ_BUFFER_SIZE:
- g_value_set_uint (value, transport->r_buf_size);
- break;
- case PROP_THRIFT_BUFFERED_TRANSPORT_WRITE_BUFFER_SIZE:
- g_value_set_uint (value, transport->w_buf_size);
- break;
- }
-}
-
-/* property mutator */
-void
-thrift_buffered_transport_set_property (GObject *object, guint property_id,
- const GValue *value, GParamSpec *pspec)
-{
- ThriftBufferedTransport *transport = THRIFT_BUFFERED_TRANSPORT (object);
-
- THRIFT_UNUSED_VAR (pspec);
-
- switch (property_id)
- {
- case PROP_THRIFT_BUFFERED_TRANSPORT_TRANSPORT:
- transport->transport = g_value_get_object (value);
- break;
- case PROP_THRIFT_BUFFERED_TRANSPORT_READ_BUFFER_SIZE:
- transport->r_buf_size = g_value_get_uint (value);
- break;
- case PROP_THRIFT_BUFFERED_TRANSPORT_WRITE_BUFFER_SIZE:
- transport->w_buf_size = g_value_get_uint (value);
- break;
- }
-}
-
-/* initializes the class */
-static void
-thrift_buffered_transport_class_init (ThriftBufferedTransportClass *cls)
-{
- ThriftTransportClass *ttc = THRIFT_TRANSPORT_CLASS (cls);
- GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
- GParamSpec *param_spec = NULL;
-
- /* setup accessors and mutators */
- gobject_class->get_property = thrift_buffered_transport_get_property;
- gobject_class->set_property = thrift_buffered_transport_set_property;
-
- param_spec = g_param_spec_object ("transport", "transport (construct)",
- "Thrift transport",
- THRIFT_TYPE_TRANSPORT,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (gobject_class,
- PROP_THRIFT_BUFFERED_TRANSPORT_TRANSPORT,
- param_spec);
-
- param_spec = g_param_spec_uint ("r_buf_size",
- "read buffer size (construct)",
- "Set the read buffer size",
- 0, /* min */
- 1048576, /* max, 1024*1024 */
- 512, /* default value */
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE);
- g_object_class_install_property (gobject_class,
- PROP_THRIFT_BUFFERED_TRANSPORT_READ_BUFFER_SIZE,
- param_spec);
-
- param_spec = g_param_spec_uint ("w_buf_size",
- "write buffer size (construct)",
- "Set the write buffer size",
- 0, /* min */
- 1048576, /* max, 1024*1024 */
- 512, /* default value */
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE);
- g_object_class_install_property (gobject_class,
- PROP_THRIFT_BUFFERED_TRANSPORT_WRITE_BUFFER_SIZE,
- param_spec);
-
-
- gobject_class->finalize = thrift_buffered_transport_finalize;
- ttc->is_open = thrift_buffered_transport_is_open;
- ttc->peek = thrift_buffered_transport_peek;
- ttc->open = thrift_buffered_transport_open;
- ttc->close = thrift_buffered_transport_close;
- ttc->read = thrift_buffered_transport_read;
- ttc->read_end = thrift_buffered_transport_read_end;
- ttc->write = thrift_buffered_transport_write;
- ttc->write_end = thrift_buffered_transport_write_end;
- ttc->flush = thrift_buffered_transport_flush;
-}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.h b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.h
deleted file mode 100644
index 837f467..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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 _THRIFT_BUFFERED_TRANSPORT_H
-#define _THRIFT_BUFFERED_TRANSPORT_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <thrift/c_glib/transport/thrift_transport.h>
-
-G_BEGIN_DECLS
-
-/*! \file thrift_buffered_transport.h
- * \brief Implementation of a Thrift buffered transport. Subclasses
- * the ThriftTransport class.
- */
-
-/* type macros */
-#define THRIFT_TYPE_BUFFERED_TRANSPORT (thrift_buffered_transport_get_type ())
-#define THRIFT_BUFFERED_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_BUFFERED_TRANSPORT, ThriftBufferedTransport))
-#define THRIFT_IS_BUFFERED_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_BUFFERED_TRANSPORT))
-#define THRIFT_BUFFERED_TRANSPORT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_BUFFERED_TRANSPORT, ThriftBufferedTransportClass))
-#define THRIFT_IS_BUFFERED_TRANSPORT_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_BUFFERED_TRANSPORT)
-#define THRIFT_BUFFERED_TRANSPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_BUFFERED_TRANSPORT, ThriftBufferedTransportClass))
-
-typedef struct _ThriftBufferedTransport ThriftBufferedTransport;
-
-/*!
- * ThriftBufferedTransport instance.
- */
-struct _ThriftBufferedTransport
-{
- ThriftTransport parent;
-
- /* protected */
- ThriftTransport *transport;
-
- /* private */
- GByteArray *r_buf;
- GByteArray *w_buf;
- guint32 r_buf_size;
- guint32 w_buf_size;
-};
-
-typedef struct _ThriftBufferedTransportClass ThriftBufferedTransportClass;
-
-/*!
- * ThriftBufferedTransport class.
- */
-struct _ThriftBufferedTransportClass
-{
- ThriftTransportClass parent;
-};
-
-/* used by THRIFT_TYPE_BUFFERED_TRANSPORT */
-GType thrift_buffered_transport_get_type (void);
-
-G_END_DECLS
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport_factory.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport_factory.c b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport_factory.c
deleted file mode 100644
index 86050b6..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport_factory.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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 <thrift/c_glib/thrift.h>
-#include <thrift/c_glib/transport/thrift_buffered_transport.h>
-#include <thrift/c_glib/transport/thrift_buffered_transport_factory.h>
-
-G_DEFINE_TYPE (ThriftBufferedTransportFactory,
- thrift_buffered_transport_factory,
- THRIFT_TYPE_TRANSPORT_FACTORY)
-
-/* Wraps a transport with a ThriftBufferedTransport. */
-ThriftTransport *
-thrift_buffered_transport_factory_get_transport (ThriftTransportFactory *factory,
- ThriftTransport *transport)
-{
- THRIFT_UNUSED_VAR (factory);
-
- return THRIFT_TRANSPORT (g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,
- "transport", transport,
- NULL));
-}
-
-static void
-thrift_buffered_transport_factory_init (ThriftBufferedTransportFactory *self)
-{
- THRIFT_UNUSED_VAR (self);
-}
-
-static void
-thrift_buffered_transport_factory_class_init (ThriftBufferedTransportFactoryClass *klass)
-{
- ThriftTransportFactoryClass *base_class =
- THRIFT_TRANSPORT_FACTORY_CLASS (klass);
-
- base_class->get_transport =
- klass->get_transport =
- thrift_buffered_transport_factory_get_transport;
-}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport_factory.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport_factory.h b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport_factory.h
deleted file mode 100644
index d43f4e4..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport_factory.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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 _THRIFT_BUFFERED_TRANSPORT_FACTORY_H
-#define _THRIFT_BUFFERED_TRANSPORT_FACTORY_H
-
-#include <glib-object.h>
-
-#include <thrift/c_glib/transport/thrift_transport.h>
-#include <thrift/c_glib/transport/thrift_transport_factory.h>
-
-G_BEGIN_DECLS
-
-/*! \file thrift_buffered_transport_factory.h
- * \brief Wraps a transport with a ThriftBufferedTransport.
- */
-
-/* type macros */
-#define THRIFT_TYPE_BUFFERED_TRANSPORT_FACTORY \
- (thrift_buffered_transport_factory_get_type ())
-#define THRIFT_BUFFERED_TRANSPORT_FACTORY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- THRIFT_TYPE_BUFFERED_TRANSPORT_FACTORY, \
- ThriftBufferedTransportFactory))
-#define THRIFT_IS_BUFFERED_TRANSPORT_FACTORY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- THRIFT_TYPE_BUFFERED_TRANSPORT_FACTORY))
-#define THRIFT_BUFFERED_TRANSPORT_FACTORY_CLASS(c) \
- (G_TYPE_CHECK_CLASS_CAST ((c), \
- THRIFT_TYPE_BUFFERED_TRANSPORT_FACTORY, \
- ThriftBufferedTransportFactoryClass))
-#define THRIFT_IS_BUFFERED_TRANSPORT_FACTORY_CLASS(c) \
- (G_TYPE_CHECK_CLASS_TYPE ((c), \
- THRIFT_TYPE_BUFFERED_TRANSPORT_FACTORY))
-#define THRIFT_BUFFERED_TRANSPORT_FACTORY_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- THRIFT_TYPE_BUFFERED_TRANSPORT_FACTORY, \
- ThriftBufferedTransportFactoryClass))
-
-typedef struct _ThriftBufferedTransportFactory ThriftBufferedTransportFactory;
-
-/* Thrift Buffered-Transport Factory instance */
-struct _ThriftBufferedTransportFactory
-{
- ThriftTransportFactory parent;
-};
-
-typedef struct _ThriftBufferedTransportFactoryClass ThriftBufferedTransportFactoryClass;
-
-/* Thrift Buffered-Transport Factory class */
-struct _ThriftBufferedTransportFactoryClass
-{
- ThriftTransportFactoryClass parent;
-
- /* vtable */
- ThriftTransport *(*get_transport) (ThriftTransportFactory *factory,
- ThriftTransport *transport);
-};
-
-/* used by THRIFT_TYPE_BUFFERED_TRANSPORT_FACTORY */
-GType thrift_buffered_transport_factory_get_type (void);
-
-/* virtual public methods */
-ThriftTransport *
-thrift_buffered_transport_factory_get_transport (ThriftTransportFactory *factory,
- ThriftTransport *transport);
-
-G_END_DECLS
-
-#endif /* _THRIFT_BUFFERED_TRANSPORT_FACTORY_H */
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
deleted file mode 100644
index 4c8b71f..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * 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 <assert.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <thrift/c_glib/thrift.h>
-#include <thrift/c_glib/transport/thrift_transport.h>
-#include <thrift/c_glib/transport/thrift_framed_transport.h>
-
-/* object properties */
-enum _ThriftFramedTransportProperties
-{
- PROP_0,
- PROP_THRIFT_FRAMED_TRANSPORT_TRANSPORT,
- PROP_THRIFT_FRAMED_TRANSPORT_READ_BUFFER_SIZE,
- PROP_THRIFT_FRAMED_TRANSPORT_WRITE_BUFFER_SIZE
-};
-
-G_DEFINE_TYPE(ThriftFramedTransport, thrift_framed_transport, THRIFT_TYPE_TRANSPORT)
-
-/* implements thrift_transport_is_open */
-gboolean
-thrift_framed_transport_is_open (ThriftTransport *transport)
-{
- ThriftFramedTransport *t = THRIFT_FRAMED_TRANSPORT (transport);
- return THRIFT_TRANSPORT_GET_CLASS (t->transport)->is_open (t->transport);
-}
-
-/* overrides thrift_transport_peek */
-gboolean
-thrift_framed_transport_peek (ThriftTransport *transport, GError **error)
-{
- ThriftFramedTransport *t = THRIFT_FRAMED_TRANSPORT (transport);
- return (t->r_buf->len > 0) || thrift_transport_peek (t->transport, error);
-}
-
-/* implements thrift_transport_open */
-gboolean
-thrift_framed_transport_open (ThriftTransport *transport, GError **error)
-{
- ThriftFramedTransport *t = THRIFT_FRAMED_TRANSPORT (transport);
- return THRIFT_TRANSPORT_GET_CLASS (t->transport)->open (t->transport, error);
-}
-
-/* implements thrift_transport_close */
-gboolean
-thrift_framed_transport_close (ThriftTransport *transport, GError **error)
-{
- ThriftFramedTransport *t = THRIFT_FRAMED_TRANSPORT (transport);
- return THRIFT_TRANSPORT_GET_CLASS (t->transport)->close (t->transport, error);
-}
-
-/* reads a frame and puts it into the buffer */
-gboolean
-thrift_framed_transport_read_frame (ThriftTransport *transport,
- GError **error)
-{
- ThriftFramedTransport *t = THRIFT_FRAMED_TRANSPORT (transport);
- guint32 sz;
- gint32 bytes;
- gboolean result = FALSE;
-
- /* read the size */
- if (thrift_transport_read (t->transport,
- &sz,
- sizeof (sz),
- error) == sizeof (sz))
- {
- guchar *tmpdata;
-
- sz = ntohl (sz);
-
- /* create a buffer to hold the data and read that much data */
- tmpdata = g_alloca (sz);
- bytes = thrift_transport_read (t->transport, tmpdata, sz, error);
-
- if (bytes > 0 && (error == NULL || *error == NULL))
- {
- /* add the data to the buffer */
- g_byte_array_append (t->r_buf, tmpdata, bytes);
-
- result = TRUE;
- }
- }
-
- return result;
-}
-
-/* the actual read is "slow" because it calls the underlying transport */
-gint32
-thrift_framed_transport_read_slow (ThriftTransport *transport, gpointer buf,
- guint32 len, GError **error)
-{
- ThriftFramedTransport *t = THRIFT_FRAMED_TRANSPORT (transport);
- guint32 want = len;
- guint32 have = t->r_buf->len;
- gint32 result = -1;
-
- /* we shouldn't hit this unless the buffer doesn't have enough to read */
- assert (t->r_buf->len < want);
-
- /* first copy what we have in our buffer, if there is anything left */
- if (have > 0)
- {
- memcpy (buf, t->r_buf, t->r_buf->len);
- want -= t->r_buf->len;
- t->r_buf = g_byte_array_remove_range (t->r_buf, 0, t->r_buf->len);
- }
-
- /* read a frame of input and buffer it */
- if (thrift_framed_transport_read_frame (transport, error) == TRUE)
- {
- /* hand over what we have up to what the caller wants */
- guint32 give = want < t->r_buf->len ? want : t->r_buf->len;
-
- /* copy the data into the buffer */
- memcpy ((guint8 *)buf + len - want, t->r_buf->data, give);
- t->r_buf = g_byte_array_remove_range (t->r_buf, 0, give);
- want -= give;
-
- result = len - want;
- }
-
- return result;
-}
-
-/* implements thrift_transport_read */
-gint32
-thrift_framed_transport_read (ThriftTransport *transport, gpointer buf,
- guint32 len, GError **error)
-{
- ThriftFramedTransport *t = THRIFT_FRAMED_TRANSPORT (transport);
-
- /* if we have enough buffer data to fulfill the read, just use
- * a memcpy from the buffer */
- if (len <= t->r_buf->len)
- {
- memcpy (buf, t->r_buf->data, len);
- g_byte_array_remove_range (t->r_buf, 0, len);
- return len;
- }
-
- return thrift_framed_transport_read_slow (transport, buf, len, error);
-}
-
-/* implements thrift_transport_read_end
- * called when read is complete. nothing to do on our end. */
-gboolean
-thrift_framed_transport_read_end (ThriftTransport *transport, GError **error)
-{
- /* satisfy -Wall */
- THRIFT_UNUSED_VAR (transport);
- THRIFT_UNUSED_VAR (error);
- return TRUE;
-}
-
-gboolean
-thrift_framed_transport_write_slow (ThriftTransport *transport, gpointer buf,
- guint32 len, GError **error)
-{
- ThriftFramedTransport *t = THRIFT_FRAMED_TRANSPORT (transport);
-
- THRIFT_UNUSED_VAR (error);
-
- /* append the data to the buffer and we're done */
- g_byte_array_append (t->w_buf, buf, len);
-
- return TRUE;
-}
-
-/* implements thrift_transport_write */
-gboolean
-thrift_framed_transport_write (ThriftTransport *transport,
- const gpointer buf,
- const guint32 len, GError **error)
-{
- ThriftFramedTransport *t = THRIFT_FRAMED_TRANSPORT (transport);
-
- /* the length of the current buffer plus the length of the data being read */
- if (t->w_buf->len + len <= t->w_buf_size)
- {
- t->w_buf = g_byte_array_append (t->w_buf, buf, len);
- return TRUE;
- }
-
- return thrift_framed_transport_write_slow (transport, buf, len, error);
-}
-
-/* implements thrift_transport_write_end
- * called when write is complete. nothing to do on our end. */
-gboolean
-thrift_framed_transport_write_end (ThriftTransport *transport, GError **error)
-{
- /* satisfy -Wall */
- THRIFT_UNUSED_VAR (transport);
- THRIFT_UNUSED_VAR (error);
- return TRUE;
-}
-
-/* implements thrift_transport_flush */
-gboolean
-thrift_framed_transport_flush (ThriftTransport *transport, GError **error)
-{
- ThriftFramedTransport *t = THRIFT_FRAMED_TRANSPORT (transport);
- gint32 sz_hbo, sz_nbo;
- guchar *tmpdata;
-
- /* get the size of the frame in host and network byte order */
- sz_hbo = t->w_buf->len + sizeof(sz_nbo);
- sz_nbo = (gint32) htonl ((guint32) t->w_buf->len);
-
- /* copy the size of the frame and then the frame itself */
- tmpdata = g_alloca (sz_hbo);
- memcpy (tmpdata, (guint8 *) &sz_nbo, sizeof (sz_nbo));
-
- if (t->w_buf->len > 0)
- {
- memcpy (tmpdata + sizeof (sz_nbo), t->w_buf->data, t->w_buf->len);
- t->w_buf = g_byte_array_remove_range (t->w_buf, 0, t->w_buf->len);
- }
-
- /* write the buffer and then empty it */
- THRIFT_TRANSPORT_GET_CLASS (t->transport)->write (t->transport,
- tmpdata, sz_hbo,
- error);
-
- THRIFT_TRANSPORT_GET_CLASS (t->transport)->flush (t->transport,
- error);
-
- return TRUE;
-}
-
-/* initializes the instance */
-static void
-thrift_framed_transport_init (ThriftFramedTransport *transport)
-{
- transport->transport = NULL;
- transport->r_buf = g_byte_array_new ();
- transport->w_buf = g_byte_array_new ();
-}
-
-/* destructor */
-static void
-thrift_framed_transport_finalize (GObject *object)
-{
- ThriftFramedTransport *transport = THRIFT_FRAMED_TRANSPORT (object);
-
- if (transport->r_buf != NULL)
- {
- g_byte_array_free (transport->r_buf, TRUE);
- }
- transport->r_buf = NULL;
-
- if (transport->w_buf != NULL)
- {
- g_byte_array_free (transport->w_buf, TRUE);
- }
- transport->w_buf = NULL;
-}
-
-/* property accessor */
-void
-thrift_framed_transport_get_property (GObject *object, guint property_id,
- GValue *value, GParamSpec *pspec)
-{
- ThriftFramedTransport *transport = THRIFT_FRAMED_TRANSPORT (object);
-
- THRIFT_UNUSED_VAR (pspec);
-
- switch (property_id)
- {
- case PROP_THRIFT_FRAMED_TRANSPORT_TRANSPORT:
- g_value_set_object (value, transport->transport);
- break;
- case PROP_THRIFT_FRAMED_TRANSPORT_READ_BUFFER_SIZE:
- g_value_set_uint (value, transport->r_buf_size);
- break;
- case PROP_THRIFT_FRAMED_TRANSPORT_WRITE_BUFFER_SIZE:
- g_value_set_uint (value, transport->w_buf_size);
- break;
- }
-}
-
-/* property mutator */
-void
-thrift_framed_transport_set_property (GObject *object, guint property_id,
- const GValue *value, GParamSpec *pspec)
-{
- ThriftFramedTransport *transport = THRIFT_FRAMED_TRANSPORT (object);
-
- THRIFT_UNUSED_VAR (pspec);
-
- switch (property_id)
- {
- case PROP_THRIFT_FRAMED_TRANSPORT_TRANSPORT:
- transport->transport = g_value_get_object (value);
- break;
- case PROP_THRIFT_FRAMED_TRANSPORT_READ_BUFFER_SIZE:
- transport->r_buf_size = g_value_get_uint (value);
- break;
- case PROP_THRIFT_FRAMED_TRANSPORT_WRITE_BUFFER_SIZE:
- transport->w_buf_size = g_value_get_uint (value);
- break;
- }
-}
-
-/* initializes the class */
-static void
-thrift_framed_transport_class_init (ThriftFramedTransportClass *cls)
-{
- ThriftTransportClass *ttc = THRIFT_TRANSPORT_CLASS (cls);
- GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
- GParamSpec *param_spec = NULL;
-
- /* setup accessors and mutators */
- gobject_class->get_property = thrift_framed_transport_get_property;
- gobject_class->set_property = thrift_framed_transport_set_property;
-
- param_spec = g_param_spec_object ("transport", "transport (construct)",
- "Thrift transport",
- THRIFT_TYPE_TRANSPORT,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (gobject_class,
- PROP_THRIFT_FRAMED_TRANSPORT_TRANSPORT,
- param_spec);
-
- param_spec = g_param_spec_uint ("r_buf_size",
- "read buffer size (construct)",
- "Set the read buffer size",
- 0, /* min */
- 1048576, /* max, 1024*1024 */
- 512, /* default value */
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE);
- g_object_class_install_property (gobject_class,
- PROP_THRIFT_FRAMED_TRANSPORT_READ_BUFFER_SIZE,
- param_spec);
-
- param_spec = g_param_spec_uint ("w_buf_size",
- "write buffer size (construct)",
- "Set the write buffer size",
- 0, /* min */
- 1048576, /* max, 1024*1024 */
- 512, /* default value */
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE);
- g_object_class_install_property (gobject_class,
- PROP_THRIFT_FRAMED_TRANSPORT_WRITE_BUFFER_SIZE,
- param_spec);
-
- gobject_class->finalize = thrift_framed_transport_finalize;
- ttc->is_open = thrift_framed_transport_is_open;
- ttc->peek = thrift_framed_transport_peek;
- ttc->open = thrift_framed_transport_open;
- ttc->close = thrift_framed_transport_close;
- ttc->read = thrift_framed_transport_read;
- ttc->read_end = thrift_framed_transport_read_end;
- ttc->write = thrift_framed_transport_write;
- ttc->write_end = thrift_framed_transport_write_end;
- ttc->flush = thrift_framed_transport_flush;
-}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.h b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.h
deleted file mode 100644
index 95c0123..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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 _THRIFT_FRAMED_TRANSPORT_H
-#define _THRIFT_FRAMED_TRANSPORT_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <thrift/c_glib/transport/thrift_transport.h>
-
-G_BEGIN_DECLS
-
-/*! \file thrift_framed_transport.h
- * \brief Implementation of a Thrift framed transport. Subclasses
- * the ThriftTransport class.
- */
-
-/* type macros */
-#define THRIFT_TYPE_FRAMED_TRANSPORT (thrift_framed_transport_get_type ())
-#define THRIFT_FRAMED_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_FRAMED_TRANSPORT, ThriftFramedTransport))
-#define THRIFT_IS_FRAMED_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_FRAMED_TRANSPORT))
-#define THRIFT_FRAMED_TRANSPORT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_FRAMED_TRANSPORT, ThriftFramedTransportClass))
-#define THRIFT_IS_FRAMED_TRANSPORT_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_FRAMED_TRANSPORT)
-#define THRIFT_FRAMED_TRANSPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_FRAMED_TRANSPORT, ThriftFramedTransportClass))
-
-typedef struct _ThriftFramedTransport ThriftFramedTransport;
-
-/*!
- * ThriftFramedTransport instance.
- */
-struct _ThriftFramedTransport
-{
- ThriftTransport parent;
-
- /* protected */
- ThriftTransport *transport;
-
- /* private */
- GByteArray *r_buf;
- GByteArray *w_buf;
- guint32 r_buf_size;
- guint32 w_buf_size;
-};
-
-typedef struct _ThriftFramedTransportClass ThriftFramedTransportClass;
-
-/*!
- * ThriftFramedTransport class.
- */
-struct _ThriftFramedTransportClass
-{
- ThriftTransportClass parent;
-};
-
-/* used by THRIFT_TYPE_FRAMED_TRANSPORT */
-GType thrift_framed_transport_get_type (void);
-
-G_END_DECLS
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport_factory.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport_factory.c b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport_factory.c
deleted file mode 100644
index e68fe0a..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport_factory.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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 <thrift/c_glib/thrift.h>
-#include <thrift/c_glib/transport/thrift_framed_transport.h>
-#include <thrift/c_glib/transport/thrift_framed_transport_factory.h>
-
-G_DEFINE_TYPE (ThriftFramedTransportFactory,
- thrift_framed_transport_factory,
- THRIFT_TYPE_TRANSPORT_FACTORY)
-
-/* Wraps a transport with a ThriftFramedTransport. */
-ThriftTransport *
-thrift_framed_transport_factory_get_transport (ThriftTransportFactory *factory,
- ThriftTransport *transport)
-{
- THRIFT_UNUSED_VAR (factory);
-
- return THRIFT_TRANSPORT (g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
- "transport", transport,
- NULL));
-}
-
-static void
-thrift_framed_transport_factory_init (ThriftFramedTransportFactory *self)
-{
- THRIFT_UNUSED_VAR (self);
-}
-
-static void
-thrift_framed_transport_factory_class_init (ThriftFramedTransportFactoryClass *klass)
-{
- ThriftTransportFactoryClass *base_class =
- THRIFT_TRANSPORT_FACTORY_CLASS (klass);
-
- base_class->get_transport =
- klass->get_transport =
- thrift_framed_transport_factory_get_transport;
-}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport_factory.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport_factory.h b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport_factory.h
deleted file mode 100644
index c3e9496..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport_factory.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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 _THRIFT_FRAMED_TRANSPORT_FACTORY_H
-#define _THRIFT_FRAMED_TRANSPORT_FACTORY_H
-
-#include <glib-object.h>
-
-#include <thrift/c_glib/transport/thrift_transport.h>
-#include <thrift/c_glib/transport/thrift_transport_factory.h>
-
-G_BEGIN_DECLS
-
-/*! \file thrift_framed_transport_factory.h
- * \brief Wraps a transport with a ThriftFramedTransport.
- */
-
-/* type macros */
-#define THRIFT_TYPE_FRAMED_TRANSPORT_FACTORY \
- (thrift_framed_transport_factory_get_type ())
-#define THRIFT_FRAMED_TRANSPORT_FACTORY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- THRIFT_TYPE_FRAMED_TRANSPORT_FACTORY, \
- ThriftFramedTransportFactory))
-#define THRIFT_IS_FRAMED_TRANSPORT_FACTORY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- THRIFT_TYPE_FRAMED_TRANSPORT_FACTORY))
-#define THRIFT_FRAMED_TRANSPORT_FACTORY_CLASS(c) \
- (G_TYPE_CHECK_CLASS_CAST ((c), \
- THRIFT_TYPE_FRAMED_TRANSPORT_FACTORY, \
- ThriftFramedTransportFactoryClass))
-#define THRIFT_IS_FRAMED_TRANSPORT_FACTORY_CLASS(c) \
- (G_TYPE_CHECK_CLASS_TYPE ((c), \
- THRIFT_TYPE_FRAMED_TRANSPORT_FACTORY))
-#define THRIFT_FRAMED_TRANSPORT_FACTORY_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- THRIFT_TYPE_FRAMED_TRANSPORT_FACTORY, \
- ThriftFramedTransportFactoryClass))
-
-typedef struct _ThriftFramedTransportFactory ThriftFramedTransportFactory;
-
-/* Thrift Framed-Transport Factory instance */
-struct _ThriftFramedTransportFactory
-{
- ThriftTransportFactory parent;
-};
-
-typedef struct _ThriftFramedTransportFactoryClass ThriftFramedTransportFactoryClass;
-
-/* Thrift Framed-Transport Factory class */
-struct _ThriftFramedTransportFactoryClass
-{
- ThriftTransportFactoryClass parent;
-
- /* vtable */
- ThriftTransport *(*get_transport) (ThriftTransportFactory *factory,
- ThriftTransport *transport);
-};
-
-/* used by THRIFT_TYPE_FRAMED_TRANSPORT_FACTORY */
-GType thrift_framed_transport_factory_get_type (void);
-
-/* virtual public methods */
-ThriftTransport *
-thrift_framed_transport_factory_get_transport (ThriftTransportFactory *factory,
- ThriftTransport *transport);
-
-G_END_DECLS
-
-#endif /* _THRIFT_FRAMED_TRANSPORT_FACTORY_H */
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c
deleted file mode 100644
index 8d66c3d..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * 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 <assert.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <thrift/c_glib/thrift.h>
-#include <thrift/c_glib/transport/thrift_transport.h>
-#include <thrift/c_glib/transport/thrift_memory_buffer.h>
-
-/* object properties */
-enum _ThriftMemoryBufferProperties
-{
- PROP_0,
- PROP_THRIFT_MEMORY_BUFFER_BUFFER_SIZE
-};
-
-G_DEFINE_TYPE(ThriftMemoryBuffer, thrift_memory_buffer, THRIFT_TYPE_TRANSPORT)
-
-/* implements thrift_transport_is_open */
-gboolean
-thrift_memory_buffer_is_open (ThriftTransport *transport)
-{
- THRIFT_UNUSED_VAR (transport);
- return TRUE;
-}
-
-/* implements thrift_transport_open */
-gboolean
-thrift_memory_buffer_open (ThriftTransport *transport, GError **error)
-{
- THRIFT_UNUSED_VAR (transport);
- THRIFT_UNUSED_VAR (error);
- return TRUE;
-}
-
-/* implements thrift_transport_close */
-gboolean
-thrift_memory_buffer_close (ThriftTransport *transport, GError **error)
-{
- THRIFT_UNUSED_VAR (transport);
- THRIFT_UNUSED_VAR (error);
- return TRUE;
-}
-
-/* implements thrift_transport_read */
-gint32
-thrift_memory_buffer_read (ThriftTransport *transport, gpointer buf,
- guint32 len, GError **error)
-{
- ThriftMemoryBuffer *t = THRIFT_MEMORY_BUFFER (transport);
- guint32 give = len;
-
- THRIFT_UNUSED_VAR (error);
-
- /* if the requested bytes are more than what we have available,
- * just give all that we have the buffer */
- if (t->buf->len < len)
- {
- give = t->buf->len;
- }
-
- memcpy (buf, t->buf->data, give);
- g_byte_array_remove_range (t->buf, 0, give);
-
- return give;
-}
-
-/* implements thrift_transport_read_end
- * called when read is complete. nothing to do on our end. */
-gboolean
-thrift_memory_buffer_read_end (ThriftTransport *transport, GError **error)
-{
- /* satisfy -Wall */
- THRIFT_UNUSED_VAR (transport);
- THRIFT_UNUSED_VAR (error);
- return TRUE;
-}
-
-/* implements thrift_transport_write */
-gboolean
-thrift_memory_buffer_write (ThriftTransport *transport,
- const gpointer buf,
- const guint32 len, GError **error)
-{
- ThriftMemoryBuffer *t = THRIFT_MEMORY_BUFFER (transport);
-
- THRIFT_UNUSED_VAR (error);
-
- /* return an exception if the buffer doesn't have enough space. */
- if (len > t->buf_size - t->buf->len)
- {
- g_set_error (error, THRIFT_TRANSPORT_ERROR, THRIFT_TRANSPORT_ERROR_SEND,
- "unable to write %d bytes to buffer of length %d",
- len, t->buf_size);
- return FALSE;
- } else {
- t->buf = g_byte_array_append (t->buf, buf, len);
- return TRUE;
- }
-}
-
-/* implements thrift_transport_write_end
- * called when write is complete. nothing to do on our end. */
-gboolean
-thrift_memory_buffer_write_end (ThriftTransport *transport, GError **error)
-{
- /* satisfy -Wall */
- THRIFT_UNUSED_VAR (transport);
- THRIFT_UNUSED_VAR (error);
- return TRUE;
-}
-
-/* implements thrift_transport_flush */
-gboolean
-thrift_memory_buffer_flush (ThriftTransport *transport, GError **error)
-{
- THRIFT_UNUSED_VAR (transport);
- THRIFT_UNUSED_VAR (error);
-
- return TRUE;
-}
-
-/* initializes the instance */
-static void
-thrift_memory_buffer_init (ThriftMemoryBuffer *transport)
-{
- transport->buf = g_byte_array_new ();
-}
-
-/* destructor */
-static void
-thrift_memory_buffer_finalize (GObject *object)
-{
- ThriftMemoryBuffer *transport = THRIFT_MEMORY_BUFFER (object);
-
- if (transport->buf != NULL)
- {
- g_byte_array_free (transport->buf, TRUE);
- }
- transport->buf = NULL;
-}
-
-/* property accessor */
-void
-thrift_memory_buffer_get_property (GObject *object, guint property_id,
- GValue *value, GParamSpec *pspec)
-{
- ThriftMemoryBuffer *transport = THRIFT_MEMORY_BUFFER (object);
-
- THRIFT_UNUSED_VAR (pspec);
-
- switch (property_id)
- {
- case PROP_THRIFT_MEMORY_BUFFER_BUFFER_SIZE:
- g_value_set_uint (value, transport->buf_size);
- break;
- }
-}
-
-/* property mutator */
-void
-thrift_memory_buffer_set_property (GObject *object, guint property_id,
- const GValue *value, GParamSpec *pspec)
-{
- ThriftMemoryBuffer *transport = THRIFT_MEMORY_BUFFER (object);
-
- THRIFT_UNUSED_VAR (pspec);
-
- switch (property_id)
- {
- case PROP_THRIFT_MEMORY_BUFFER_BUFFER_SIZE:
- transport->buf_size = g_value_get_uint (value);
- break;
- }
-}
-
-/* initializes the class */
-static void
-thrift_memory_buffer_class_init (ThriftMemoryBufferClass *cls)
-{
- ThriftTransportClass *ttc = THRIFT_TRANSPORT_CLASS (cls);
- GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
- GParamSpec *param_spec = NULL;
-
- /* setup accessors and mutators */
- gobject_class->get_property = thrift_memory_buffer_get_property;
- gobject_class->set_property = thrift_memory_buffer_set_property;
-
- param_spec = g_param_spec_uint ("buf_size",
- "buffer size (construct)",
- "Set the read buffer size",
- 0, /* min */
- 1048576, /* max, 1024*1024 */
- 512, /* default value */
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE);
- g_object_class_install_property (gobject_class,
- PROP_THRIFT_MEMORY_BUFFER_BUFFER_SIZE,
- param_spec);
-
- gobject_class->finalize = thrift_memory_buffer_finalize;
- ttc->is_open = thrift_memory_buffer_is_open;
- ttc->open = thrift_memory_buffer_open;
- ttc->close = thrift_memory_buffer_close;
- ttc->read = thrift_memory_buffer_read;
- ttc->read_end = thrift_memory_buffer_read_end;
- ttc->write = thrift_memory_buffer_write;
- ttc->write_end = thrift_memory_buffer_write_end;
- ttc->flush = thrift_memory_buffer_flush;
-}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.h b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.h
deleted file mode 100644
index 4ebe98f..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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 _THRIFT_MEMORY_BUFFER_H
-#define _THRIFT_MEMORY_BUFFER_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <thrift/c_glib/transport/thrift_transport.h>
-
-G_BEGIN_DECLS
-
-/*! \file thrift_memory_buffer.h
- * \brief Implementation of a Thrift memory buffer transport.
- */
-
-/* type macros */
-#define THRIFT_TYPE_MEMORY_BUFFER (thrift_memory_buffer_get_type ())
-#define THRIFT_MEMORY_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_MEMORY_BUFFER, ThriftMemoryBuffer))
-#define THRIFT_IS_MEMORY_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_MEMORY_BUFFER))
-#define THRIFT_MEMORY_BUFFER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_MEMORY_BUFFER, ThriftMemoryBufferClass))
-#define THRIFT_IS_MEMORY_BUFFER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_MEMORY_BUFFER)
-#define THRIFT_MEMORY_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_MEMORY_BUFFER, ThriftMemoryBufferClass))
-
-typedef struct _ThriftMemoryBuffer ThriftMemoryBuffer;
-
-/*!
- * ThriftMemoryBuffer instance.
- */
-struct _ThriftMemoryBuffer
-{
- ThriftTransport parent;
-
- /* private */
- GByteArray *buf;
- guint32 buf_size;
-};
-
-typedef struct _ThriftMemoryBufferClass ThriftMemoryBufferClass;
-
-/*!
- * ThriftMemoryBuffer class.
- */
-struct _ThriftMemoryBufferClass
-{
- ThriftTransportClass parent;
-};
-
-/* used by THRIFT_TYPE_MEMORY_BUFFER */
-GType thrift_memory_buffer_get_type (void);
-
-G_END_DECLS
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.c b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.c
deleted file mode 100644
index 97a0ec2..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * 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 <errno.h>
-#include <netdb.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <thrift/c_glib/thrift.h>
-#include <thrift/c_glib/transport/thrift_socket.h>
-#include <thrift/c_glib/transport/thrift_transport.h>
-#include <thrift/c_glib/transport/thrift_server_transport.h>
-#include <thrift/c_glib/transport/thrift_server_socket.h>
-
-/* object properties */
-enum _ThriftServerSocketProperties
-{
- PROP_0,
- PROP_THRIFT_SERVER_SOCKET_PORT,
- PROP_THRIFT_SERVER_SOCKET_BACKLOG
-};
-
-/* define the GError domain string */
-#define THRIFT_SERVER_SOCKET_ERROR_DOMAIN "thrift-server-socket-error-quark"
-
-/* for errors coming from socket() and connect() */
-extern int errno;
-
-G_DEFINE_TYPE(ThriftServerSocket, thrift_server_socket, THRIFT_TYPE_SERVER_TRANSPORT)
-
-gboolean
-thrift_server_socket_listen (ThriftServerTransport *transport, GError **error)
-{
- int enabled = 1; /* for setsockopt() */
- struct sockaddr_in pin;
- ThriftServerSocket *tsocket = THRIFT_SERVER_SOCKET (transport);
-
- /* create a address structure */
- memset (&pin, 0, sizeof(pin));
- pin.sin_family = AF_INET;
- pin.sin_addr.s_addr = INADDR_ANY;
- pin.sin_port = htons(tsocket->port);
-
- /* create a socket */
- if ((tsocket->sd = socket (AF_INET, SOCK_STREAM, 0)) == -1)
- {
- g_set_error (error, THRIFT_SERVER_SOCKET_ERROR,
- THRIFT_SERVER_SOCKET_ERROR_SOCKET,
- "failed to create socket - %s", strerror (errno));
- return FALSE;
- }
-
- if (setsockopt(tsocket->sd, SOL_SOCKET, SO_REUSEADDR, &enabled,
- sizeof(enabled)) == -1)
- {
- g_set_error (error, THRIFT_SERVER_SOCKET_ERROR,
- THRIFT_SERVER_SOCKET_ERROR_SETSOCKOPT,
- "unable to set SO_REUSEADDR - %s", strerror(errno));
- return FALSE;
- }
-
- /* bind to the socket */
- if (bind(tsocket->sd, (struct sockaddr *) &pin, sizeof(pin)) == -1)
- {
- g_set_error (error, THRIFT_SERVER_SOCKET_ERROR,
- THRIFT_SERVER_SOCKET_ERROR_BIND,
- "failed to bind to port %d - %s",
- tsocket->port, strerror(errno));
- return FALSE;
- }
-
- if (listen(tsocket->sd, tsocket->backlog) == -1)
- {
- g_set_error (error, THRIFT_SERVER_SOCKET_ERROR,
- THRIFT_SERVER_SOCKET_ERROR_LISTEN,
- "failed to listen to port %d - %s",
- tsocket->port, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
-ThriftTransport *
-thrift_server_socket_accept (ThriftServerTransport *transport, GError **error)
-{
- int sd = THRIFT_INVALID_SOCKET;
- guint addrlen = 0;
- struct sockaddr_in address;
- ThriftSocket *socket = NULL;
-
- ThriftServerSocket *tsocket = THRIFT_SERVER_SOCKET (transport);
-
- if ((sd = accept(tsocket->sd, (struct sockaddr *) &address, &addrlen)) == -1)
- {
- g_set_error (error, THRIFT_SERVER_SOCKET_ERROR,
- THRIFT_SERVER_SOCKET_ERROR_ACCEPT,
- "failed to accept connection - %s",
- strerror(errno));
- return FALSE;
- }
-
- socket = g_object_new (THRIFT_TYPE_SOCKET, NULL);
- socket->sd = sd;
-
- return THRIFT_TRANSPORT(socket);
-}
-
-gboolean
-thrift_server_socket_close (ThriftServerTransport *transport, GError **error)
-{
- ThriftServerSocket *tsocket = THRIFT_SERVER_SOCKET (transport);
-
- if (close (tsocket->sd) == -1)
- {
- g_set_error (error, THRIFT_SERVER_SOCKET_ERROR,
- THRIFT_SERVER_SOCKET_ERROR_CLOSE,
- "unable to close socket - %s", strerror(errno));
- return FALSE;
- }
- tsocket->sd = THRIFT_INVALID_SOCKET;
-
- return TRUE;
-}
-
-/* define the GError domain for this implementation */
-GQuark
-thrift_server_socket_error_quark (void)
-{
- return g_quark_from_static_string(THRIFT_SERVER_SOCKET_ERROR_DOMAIN);
-}
-
-/* initializes the instance */
-static void
-thrift_server_socket_init (ThriftServerSocket *socket)
-{
- socket->sd = THRIFT_INVALID_SOCKET;
-}
-
-/* destructor */
-static void
-thrift_server_socket_finalize (GObject *object)
-{
- ThriftServerSocket *socket = THRIFT_SERVER_SOCKET (object);
-
- if (socket->sd != THRIFT_INVALID_SOCKET)
- {
- close (socket->sd);
- }
- socket->sd = THRIFT_INVALID_SOCKET;
-}
-
-/* property accessor */
-void
-thrift_server_socket_get_property (GObject *object, guint property_id,
- GValue *value, GParamSpec *pspec)
-{
- ThriftServerSocket *socket = THRIFT_SERVER_SOCKET (object);
-
- switch (property_id)
- {
- case PROP_THRIFT_SERVER_SOCKET_PORT:
- g_value_set_uint (value, socket->port);
- break;
- case PROP_THRIFT_SERVER_SOCKET_BACKLOG:
- g_value_set_uint (value, socket->backlog);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-/* property mutator */
-void
-thrift_server_socket_set_property (GObject *object, guint property_id,
- const GValue *value, GParamSpec *pspec)
-{
- ThriftServerSocket *socket = THRIFT_SERVER_SOCKET (object);
-
- switch (property_id)
- {
- case PROP_THRIFT_SERVER_SOCKET_PORT:
- socket->port = g_value_get_uint (value);
- break;
- case PROP_THRIFT_SERVER_SOCKET_BACKLOG:
- socket->backlog = g_value_get_uint (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-/* initializes the class */
-static void
-thrift_server_socket_class_init (ThriftServerSocketClass *cls)
-{
- ThriftServerTransportClass *tstc = THRIFT_SERVER_TRANSPORT_CLASS (cls);
- GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
- GParamSpec *param_spec = NULL;
-
- /* setup accessors and mutators */
- gobject_class->get_property = thrift_server_socket_get_property;
- gobject_class->set_property = thrift_server_socket_set_property;
-
- param_spec = g_param_spec_uint ("port",
- "port (construct)",
- "Set the port to listen to",
- 0, /* min */
- 65534, /* max */
- 9090, /* default by convention */
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE);
- g_object_class_install_property (gobject_class,
- PROP_THRIFT_SERVER_SOCKET_PORT,
- param_spec);
-
- param_spec = g_param_spec_uint ("backlog",
- "backlog (construct)",
- "Set the accept backlog",
- 0, /* max */
- 65534, /* max */
- 1024, /* default */
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE);
- g_object_class_install_property (gobject_class,
- PROP_THRIFT_SERVER_SOCKET_BACKLOG,
- param_spec);
-
- gobject_class->finalize = thrift_server_socket_finalize;
-
- tstc->listen = thrift_server_socket_listen;
- tstc->accept = thrift_server_socket_accept;
- tstc->close = thrift_server_socket_close;
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.h b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.h
deleted file mode 100644
index f072cb0..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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 _THRIFT_SERVER_SOCKET_H
-#define _THRIFT_SERVER_SOCKET_H
-
-#include <glib-object.h>
-
-#include "thrift_server_transport.h"
-
-G_BEGIN_DECLS
-
-/*! \file thrift_server_socket.h
- * \brief Socket implementation of a Thrift server transport. Implements the
- * ThriftServerTransport class.
- */
-
-/* type macros */
-#define THRIFT_TYPE_SERVER_SOCKET (thrift_server_socket_get_type ())
-#define THRIFT_SERVER_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_SERVER_SOCKET, ThriftServerSocket))
-#define THRIFT_IS_SERVER_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_SERVER_SOCKET))
-#define THRIFT_SERVER_SOCKET_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_SERVER_SOCKET, ThriftServerSocketClass))
-#define THRIFT_IS_SERVER_SOCKET_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_SERVER_SOCKET))
-#define THRIFT_SERVER_SOCKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_SERVER_SOCKET, ThriftServerSocketClass))
-
-typedef struct _ThriftServerSocket ThriftServerSocket;
-
-/*!
- * Thrift ServerSocket instance.
- */
-struct _ThriftServerSocket
-{
- ThriftServerTransport parent;
-
- /* private */
- gshort port;
- gshort backlog;
- int sd;
- guint8 *buf;
- guint32 buf_size;
- guint32 buf_len;
-};
-
-typedef struct _ThriftServerSocketClass ThriftServerSocketClass;
-
-/*!
- * Thrift ServerSocket class.
- */
-struct _ThriftServerSocketClass
-{
- ThriftServerTransportClass parent;
-};
-
-/* used by THRIFT_TYPE_SERVER_SOCKET */
-GType thrift_server_socket_get_type (void);
-
-/* define error/exception types */
-typedef enum
-{
- THRIFT_SERVER_SOCKET_ERROR_SOCKET,
- THRIFT_SERVER_SOCKET_ERROR_SETSOCKOPT,
- THRIFT_SERVER_SOCKET_ERROR_BIND,
- THRIFT_SERVER_SOCKET_ERROR_LISTEN,
- THRIFT_SERVER_SOCKET_ERROR_ACCEPT,
- THRIFT_SERVER_SOCKET_ERROR_CLOSE
-} ThriftServerSocketError;
-
-/* define a error domain for GError to use */
-GQuark thrift_server_socket_error_quark (void);
-#define THRIFT_SERVER_SOCKET_ERROR (thrift_server_socket_error_quark ())
-
-G_END_DECLS
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.c b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.c
deleted file mode 100644
index c25d138..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 <thrift/c_glib/thrift.h>
-#include <thrift/c_glib/transport/thrift_transport.h>
-#include <thrift/c_glib/transport/thrift_server_transport.h>
-
-G_DEFINE_ABSTRACT_TYPE(ThriftServerTransport, thrift_server_transport, G_TYPE_OBJECT)
-
-/* base initializer for the server transport interface */
-static void
-thrift_server_transport_class_init (ThriftServerTransportClass *c)
-{
- c->listen = thrift_server_transport_listen;
- c->accept = thrift_server_transport_accept;
- c->close = thrift_server_transport_close;
-}
-
-static void
-thrift_server_transport_init (ThriftServerTransport *transport)
-{
- THRIFT_UNUSED_VAR (transport);
-}
-
-gboolean
-thrift_server_transport_listen (ThriftServerTransport *transport,
- GError **error)
-{
- return THRIFT_SERVER_TRANSPORT_GET_CLASS (transport)->listen (transport,
- error);
-}
-
-ThriftTransport *
-thrift_server_transport_accept (ThriftServerTransport *transport,
- GError **error)
-{
- return THRIFT_SERVER_TRANSPORT_GET_CLASS (transport)->accept (transport,
- error);
-}
-
-gboolean
-thrift_server_transport_close (ThriftServerTransport *transport, GError **error)
-{
- return THRIFT_SERVER_TRANSPORT_GET_CLASS (transport)->close (transport,
- error);
-}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.h
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.h b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.h
deleted file mode 100644
index 98a9191..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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 _THRIFT_SERVER_TRANSPORT_H
-#define _THRIFT_SERVER_TRANSPORT_H
-
-#include <glib-object.h>
-
-#include "thrift_transport.h"
-
-G_BEGIN_DECLS
-
-/*! \file thrift_server_transport.h
- * \brief Abstract class for Thrift server transports.
- */
-
-/* type macros */
-#define THRIFT_TYPE_SERVER_TRANSPORT (thrift_server_transport_get_type ())
-#define THRIFT_SERVER_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_SERVER_TRANSPORT, ThriftServerTransport))
-#define THRIFT_IS_SERVER_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_SERVER_TRANSPORT))
-#define THRIFT_SERVER_TRANSPORT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_SERVER_TRANSPORT, ThriftServerTransportClass))
-#define THRIFT_IS_SERVER_TRANSPORT_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_SERVER_TRANSPORT))
-#define THRIFT_SERVER_TRANSPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_SERVER_TRANSPORT, ThriftServerTransportClass))
-
-typedef struct _ThriftServerTransport ThriftServerTransport;
-
-struct _ThriftServerTransport
-{
- GObject parent;
-};
-
-typedef struct _ThriftServerTransportClass ThriftServerTransportClass;
-
-/*!
- * Thrift Transport class
- */
-struct _ThriftServerTransportClass
-{
- GObjectClass parent;
-
- /* vtable */
- gboolean (*listen) (ThriftServerTransport *transport, GError **error);
- ThriftTransport *(*accept) (ThriftServerTransport *transport, GError **error);
- gboolean (*close) (ThriftServerTransport *transport, GError **error);
-};
-
-/* used by THRIFT_TYPE_SERVER_TRANSPORT */
-GType thrift_server_transport_get_type (void);
-
-/*!
- * Listen for new connections.
- * \public \memberof ThriftServerTransportClass
- */
-gboolean thrift_server_transport_listen (ThriftServerTransport *transport,
- GError **error);
-
-/*!
- * Accept a connection.
- * \public \memberof ThriftServerTransportClass
- */
-ThriftTransport *thrift_server_transport_accept
- (ThriftServerTransport *transport, GError **error);
-
-/*!
- * Close the transport.
- * \public \memberof ThriftServerTransportClass
- */
-gboolean thrift_server_transport_close (ThriftServerTransport *transport,
- GError **error);
-
-G_END_DECLS
-
-#endif /* _THRIFT_SERVER_TRANSPORT_H */
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c
deleted file mode 100644
index 1c147ec..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * 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 <errno.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <thrift/c_glib/thrift.h>
-#include <thrift/c_glib/transport/thrift_transport.h>
-#include <thrift/c_glib/transport/thrift_socket.h>
-
-/* object properties */
-enum _ThriftSocketProperties
-{
- PROP_0,
- PROP_THRIFT_SOCKET_HOSTNAME,
- PROP_THRIFT_SOCKET_PORT
-};
-
-/* for errors coming from socket() and connect() */
-extern int errno;
-
-G_DEFINE_TYPE(ThriftSocket, thrift_socket, THRIFT_TYPE_TRANSPORT)
-
-/* implements thrift_transport_is_open */
-gboolean
-thrift_socket_is_open (ThriftTransport *transport)
-{
- ThriftSocket *socket = THRIFT_SOCKET (transport);
- return socket->sd != THRIFT_INVALID_SOCKET;
-}
-
-/* overrides thrift_transport_peek */
-gboolean
-thrift_socket_peek (ThriftTransport *transport, GError **error)
-{
- gboolean result = FALSE;
- guint8 buf;
- int r;
- int errno_copy;
-
- ThriftSocket *socket = THRIFT_SOCKET (transport);
-
- if (thrift_socket_is_open (transport))
- {
- r = recv (socket->sd, &buf, 1, MSG_PEEK);
- if (r == -1)
- {
- errno_copy = errno;
-
- #if defined __FreeBSD__ || defined __MACH__
- /* FreeBSD returns -1 and ECONNRESET if the socket was closed by the other
- side */
- if (errno_copy == ECONNRESET)
- {
- thrift_socket_close (transport, error);
- }
- else
- {
- #endif
-
- g_set_error (error,
- THRIFT_TRANSPORT_ERROR,
- THRIFT_TRANSPORT_ERROR_SOCKET,
- "failed to peek at socket - %s",
- strerror (errno_copy));
-
- #if defined __FreeBSD__ || defined __MACH__
- }
- #endif
- }
- else if (r > 0)
- {
- result = TRUE;
- }
- }
-
- return result;
-}
-
-/* implements thrift_transport_open */
-gboolean
-thrift_socket_open (ThriftTransport *transport, GError **error)
-{
- struct hostent *hp = NULL;
- struct sockaddr_in pin;
- int err;
-#if defined(HAVE_GETHOSTBYNAME_R)
- struct hostent he;
- char buf[1024];
-#endif
-
- ThriftSocket *tsocket = THRIFT_SOCKET (transport);
- g_return_val_if_fail (tsocket->sd == THRIFT_INVALID_SOCKET, FALSE);
-
- /* lookup the destination host */
-#if defined(HAVE_GETHOSTBYNAME_R)
- if (gethostbyname_r (tsocket->hostname, &he, buf, 1024, &hp, &err) != 0 || hp == NULL)
-#else
- if ((hp = gethostbyname (tsocket->hostname)) == NULL && (err = h_errno))
-#endif
- {
- /* host lookup failed, bail out with an error */
- g_set_error (error, THRIFT_TRANSPORT_ERROR, THRIFT_TRANSPORT_ERROR_HOST,
- "host lookup failed for %s:%d - %s",
- tsocket->hostname, tsocket->port,
- hstrerror (err));
- return FALSE;
- }
-
- /* create a socket structure */
- memset (&pin, 0, sizeof(pin));
- pin.sin_family = AF_INET;
- pin.sin_addr.s_addr = ((struct in_addr *) (hp->h_addr))->s_addr;
- pin.sin_port = htons (tsocket->port);
-
- /* create the socket */
- if ((tsocket->sd = socket (AF_INET, SOCK_STREAM, 0)) == -1)
- {
- g_set_error (error, THRIFT_TRANSPORT_ERROR, THRIFT_TRANSPORT_ERROR_SOCKET,
- "failed to create socket for host %s:%d - %s",
- tsocket->hostname, tsocket->port,
- strerror(errno));
- return FALSE;
- }
-
- /* open a connection */
- if (connect (tsocket->sd, (struct sockaddr *) &pin, sizeof(pin)) == -1)
- {
- g_set_error (error, THRIFT_TRANSPORT_ERROR, THRIFT_TRANSPORT_ERROR_CONNECT,
- "failed to connect to host %s:%d - %s",
- tsocket->hostname, tsocket->port, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* implements thrift_transport_close */
-gboolean
-thrift_socket_close (ThriftTransport *transport, GError **error)
-{
- ThriftSocket *socket = THRIFT_SOCKET (transport);
-
- if (close (socket->sd) == -1)
- {
- g_set_error (error, THRIFT_TRANSPORT_ERROR, THRIFT_TRANSPORT_ERROR_CLOSE,
- "unable to close socket - %s",
- strerror(errno));
- return FALSE;
- }
-
- socket->sd = THRIFT_INVALID_SOCKET;
- return TRUE;
-}
-
-/* implements thrift_transport_read */
-gint32
-thrift_socket_read (ThriftTransport *transport, gpointer buf,
- guint32 len, GError **error)
-{
- gint ret = 0;
- guint got = 0;
-
- ThriftSocket *socket = THRIFT_SOCKET (transport);
-
- while (got < len)
- {
- ret = recv (socket->sd, (guint8 *)buf + got, len-got, 0);
- if (ret <= 0)
- {
- g_set_error (error, THRIFT_TRANSPORT_ERROR,
- THRIFT_TRANSPORT_ERROR_RECEIVE,
- "failed to read %d bytes - %s", len, strerror(errno));
- return -1;
- }
- got += ret;
- }
-
- return got;
-}
-
-/* implements thrift_transport_read_end
- * called when write is complete. nothing to do on our end. */
-gboolean
-thrift_socket_read_end (ThriftTransport *transport, GError **error)
-{
- /* satisfy -Wall */
- THRIFT_UNUSED_VAR (transport);
- THRIFT_UNUSED_VAR (error);
- return TRUE;
-}
-
-/* implements thrift_transport_write */
-gboolean
-thrift_socket_write (ThriftTransport *transport, const gpointer buf,
- const guint32 len, GError **error)
-{
- gint ret = 0;
- guint sent = 0;
-
- ThriftSocket *socket = THRIFT_SOCKET (transport);
- g_return_val_if_fail (socket->sd != THRIFT_INVALID_SOCKET, FALSE);
-
- while (sent < len)
- {
- ret = send (socket->sd, (guint8 *)buf + sent, len - sent, 0);
- if (ret < 0)
- {
- g_set_error (error, THRIFT_TRANSPORT_ERROR,
- THRIFT_TRANSPORT_ERROR_SEND,
- "failed to send %d bytes - %s", len, strerror(errno));
- return FALSE;
- }
- sent += ret;
- }
-
- return TRUE;
-}
-
-/* implements thrift_transport_write_end
- * called when write is complete. nothing to do on our end. */
-gboolean
-thrift_socket_write_end (ThriftTransport *transport, GError **error)
-{
- /* satisfy -Wall */
- THRIFT_UNUSED_VAR (transport);
- THRIFT_UNUSED_VAR (error);
- return TRUE;
-}
-
-/* implements thrift_transport_flush
- * flush pending data. since we are not buffered, this is a no-op */
-gboolean
-thrift_socket_flush (ThriftTransport *transport, GError **error)
-{
- /* satisfy -Wall */
- THRIFT_UNUSED_VAR (transport);
- THRIFT_UNUSED_VAR (error);
- return TRUE;
-}
-
-/* initializes the instance */
-static void
-thrift_socket_init (ThriftSocket *socket)
-{
- socket->sd = THRIFT_INVALID_SOCKET;
-}
-
-/* destructor */
-static void
-thrift_socket_finalize (GObject *object)
-{
- ThriftSocket *socket = THRIFT_SOCKET (object);
-
- if (socket->hostname != NULL)
- {
- g_free (socket->hostname);
- }
- socket->hostname = NULL;
-
- if (socket->sd != THRIFT_INVALID_SOCKET)
- {
- close (socket->sd);
- }
- socket->sd = THRIFT_INVALID_SOCKET;
-}
-
-/* property accessor */
-void
-thrift_socket_get_property (GObject *object, guint property_id,
- GValue *value, GParamSpec *pspec)
-{
- ThriftSocket *socket = THRIFT_SOCKET (object);
-
- THRIFT_UNUSED_VAR (pspec);
-
- switch (property_id)
- {
- case PROP_THRIFT_SOCKET_HOSTNAME:
- g_value_set_string (value, socket->hostname);
- break;
- case PROP_THRIFT_SOCKET_PORT:
- g_value_set_uint (value, socket->port);
- break;
- }
-}
-
-/* property mutator */
-void
-thrift_socket_set_property (GObject *object, guint property_id,
- const GValue *value, GParamSpec *pspec)
-{
- ThriftSocket *socket = THRIFT_SOCKET (object);
-
- THRIFT_UNUSED_VAR (pspec);
-
- switch (property_id)
- {
- case PROP_THRIFT_SOCKET_HOSTNAME:
- socket->hostname = g_strdup (g_value_get_string (value));
- break;
- case PROP_THRIFT_SOCKET_PORT:
- socket->port = g_value_get_uint (value);
- break;
- }
-}
-
-/* initializes the class */
-static void
-thrift_socket_class_init (ThriftSocketClass *cls)
-{
- ThriftTransportClass *ttc = THRIFT_TRANSPORT_CLASS (cls);
- GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
- GParamSpec *param_spec = NULL;
-
- /* setup accessors and mutators */
- gobject_class->get_property = thrift_socket_get_property;
- gobject_class->set_property = thrift_socket_set_property;
-
- param_spec = g_param_spec_string ("hostname",
- "hostname (construct)",
- "Set the hostname of the remote host",
- "localhost", /* default value */
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE);
- g_object_class_install_property (gobject_class, PROP_THRIFT_SOCKET_HOSTNAME,
- param_spec);
-
- param_spec = g_param_spec_uint ("port",
- "port (construct)",
- "Set the port of the remote host",
- 0, /* min */
- 65534, /* max */
- 9090, /* default by convention */
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE);
- g_object_class_install_property (gobject_class, PROP_THRIFT_SOCKET_PORT,
- param_spec);
-
- gobject_class->finalize = thrift_socket_finalize;
- ttc->is_open = thrift_socket_is_open;
- ttc->peek = thrift_socket_peek;
- ttc->open = thrift_socket_open;
- ttc->close = thrift_socket_close;
- ttc->read = thrift_socket_read;
- ttc->read_end = thrift_socket_read_end;
- ttc->write = thrift_socket_write;
- ttc->write_end = thrift_socket_write_end;
- ttc->flush = thrift_socket_flush;
-}