Send Linux-ha-cvs mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."
Today's Topics:
1. Linux-HA CVS: lib by gshi from ([email protected])
----------------------------------------------------------------------
Message: 1
Date: Fri, 2 Dec 2005 16:49:52 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by gshi from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : gshi
Host :
Project : linux-ha
Module : lib
Dir : linux-ha/lib/clplumbing
Modified Files:
cl_compress.c cl_msg_types.c
Log Message:
add some comments for message types and compression
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/clplumbing/cl_compress.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- cl_compress.c 17 Oct 2005 16:21:13 -0000 1.8
+++ cl_compress.c 2 Dec 2005 23:49:50 -0000 1.9
@@ -18,6 +18,39 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+/*
+ * Compression is designed to handle big messages, right now with 4 nodes
+ * cib message can go up to 64 KB or more. I expect much larger messages
+ * when the number of node increase. This makes message compression necessary.
+ *
+ *
+ * Compression is handled in field level. One can add a struct field using
+ * ha_msg_addstruct() -- the field will not get compressed, or using
+ * ha_msg_addstruct_compress(), and the field will get compressed when
+ * the message is converted to wire format, i.e. when msg2wirefmt() is called.
+ * The compressed field will stay compressed until it reached the desination.
+ * It will finally decompressed when the user start to get the field value.
+ * It is designed this way so that the compression/decompression only happens
+ * in end users so that heartbeat itself can save cpu cycle and memory.
+ * (more info about compression can be found in cl_msg_types.c about
FT_COMPRESS
+ * FT_UNCOMPRESS types)
+ *
+ * compression has another legacy mode, which is there so it can be compatible
+ * to old ways of compression. In the old way, no field is compressed
individually
+ * and the messages is compressed before it is sent out, and it will be
decompressed
+ * in the receiver side immediately. So in each IPC channel, the message is
compressed
+ * and decompressed once. This way will cost a lot of cpu time and memory and
it is
+ * discouraged.
+ *
+ * If use_traditional_compression is true, then it is using the legacy mode,
otherwise
+ * it is using the new compression. For back compatibility, the default is
legacy mode.
+ *
+ * The real compression work is done by compression plugins. There are two
plugins right
+ * now: zlib and bz2, they are in lib/plugins/HBcompress
+ *
+ */
+
#include <portability.h>
#include <stdlib.h>
#include <stdio.h>
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/clplumbing/cl_msg_types.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- cl_msg_types.c 14 Nov 2005 21:05:50 -0000 1.33
+++ cl_msg_types.c 2 Dec 2005 23:49:50 -0000 1.34
@@ -1639,6 +1639,33 @@
return cl_msg_replace(msg, index, (char*)msgfield, 0, FT_UNCOMPRESS);/*
resource leak */
}
+/*
+ * string FT_STRING
+ * string is the basic type used in heartbeat, it is used for
printable ascii value
+ *
+ * binary FT_BINARY
+ * binary means the value can be any binary value, including
non-printable ascii value
+ *
+ * struct FT_STRUCT
+ * struct means the value is also an ha_msg (actually it is a
pointer to an ha message)
+ *
+ * list FT_LIST
+ * LIST means the value is a GList. Right now we only suppport a
Glist of strings
+ *
+ * compress FT_COMPRESS
+ * This field and the next one(FT_UNCOMPRESS) is designed to
optimize compression in message
+ * (see cl_compression.c for more about compression). This field
is similar to the binary field.
+ * It stores a compressed field, which will be an ha_msg if
uncompressed. Most of time this field
+ * act like a binary field until compress2uncompress() is called.
That function will be called
+ * when someone calls cl_get_struct() to get this field value.
After that this field is converted
+ * to a new type FT_UNCOMPRESS
+ *
+ * uncompress FT_UNCOMPRESS
+ * As said above, this field is used to optimize compression. This
field is similar to the struct
+ * field. It's value is a pointer to an ha_msg. This field will be
converted to a new type FT_COMPRESS
+ * when msg2wirefmt() is called, where uncompress2compress is
called to do the field compression
+ */
+
struct fieldtypefuncs_s fieldtypefuncs[NUM_MSG_TYPES]=
{ {string_memfree, string_dup, string_display, add_string_field,
string_stringlen,string_netstringlen, str2string,fields2netstring,
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 25, Issue 3
*******************************************