tom | 1d416c5 | 2014-09-29 20:55:24 -0700 | [diff] [blame] | 1 | package org.onlab.onos.store.cluster.messaging; |
| 2 | |
| 3 | import java.nio.ByteBuffer; |
| 4 | |
| 5 | /** |
tom | 8158314 | 2014-09-30 01:40:29 -0700 | [diff] [blame^] | 6 | * Service for encoding & decoding intra-cluster messages. |
tom | 1d416c5 | 2014-09-29 20:55:24 -0700 | [diff] [blame] | 7 | */ |
| 8 | public interface SerializationService { |
| 9 | |
| 10 | /** |
tom | 8158314 | 2014-09-30 01:40:29 -0700 | [diff] [blame^] | 11 | * Decodes the specified byte buffer to obtain the message within. |
tom | 1d416c5 | 2014-09-29 20:55:24 -0700 | [diff] [blame] | 12 | * |
| 13 | * @param buffer byte buffer with message(s) |
| 14 | * @return parsed message |
| 15 | */ |
| 16 | ClusterMessage decode(ByteBuffer buffer); |
| 17 | |
| 18 | /** |
| 19 | * Encodes the specified message into the given byte buffer. |
| 20 | * |
| 21 | * @param message message to be encoded |
| 22 | * @param buffer byte buffer to receive the message data |
| 23 | */ |
| 24 | void encode(ClusterMessage message, ByteBuffer buffer); |
| 25 | |
| 26 | } |