1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package org.apache.giraph.comm.messages; 20 21 /** 22 * There are two types of message-stores currently 23 * pointer based, and default byte-array based 24 */ 25 public enum MessageEncodeAndStoreType { 26 /** 27 * Use a byte-array to store messages for each partition 28 */ 29 BYTEARRAY_PER_PARTITION(false), 30 /** 31 * Extract a byte array per partition from one message to many ids encoding 32 * and then store 33 */ 34 EXTRACT_BYTEARRAY_PER_PARTITION(true), 35 /** 36 * Use message-store which is based on list of pointers to encoded messages 37 */ 38 POINTER_LIST_PER_VERTEX(true); 39 40 /** Can use one message to many ids encoding? */ 41 private final boolean oneMessageToManyIdsEncoding; 42 43 /** 44 * Constructor 45 * 46 * @param oneMessageToManyIdsEncoding use one message to many ids encoding 47 */ 48 MessageEncodeAndStoreType(boolean oneMessageToManyIdsEncoding) { 49 this.oneMessageToManyIdsEncoding = oneMessageToManyIdsEncoding; 50 } 51 52 /** 53 * True if one message to many ids encoding is set 54 * @return return oneMessageToManyIdsEncoding 55 */ 56 public boolean useOneMessageToManyIdsEncoding() { 57 return oneMessageToManyIdsEncoding; 58 } 59 }