http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxReader.hpp ---------------------------------------------------------------------- diff --git a/clicache/src/IPdxReader.hpp b/clicache/src/IPdxReader.hpp new file mode 100644 index 0000000..cccb840 --- /dev/null +++ b/clicache/src/IPdxReader.hpp @@ -0,0 +1,211 @@ +/* + * 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 "geode_defs.hpp" +#include "IRegion.hpp" +#include "IPdxUnreadFields.hpp" +namespace Apache +{ + namespace Geode + { + namespace Client + { + + /// <summary> + /// A IPdxReader will be passed to IPdxSerializable.fromData or + /// during deserialization of a PDX. The domain class needs to deserialize field members + /// using this interface. This interface is implemented by Native Client. + /// Each readXXX call will return the field's value. If the serialized + /// PDX does not contain the named field then a default value will + /// be returned. Standard Java defaults are used. For Objects this is + /// null and for primitives it is 0 or 0.0. + /// </summary> + public interface class IPdxReader + { + public: + + /// <summary> + /// Read a signed byte from the stream. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + SByte ReadByte( String^ fieldName ); + + /// <summary> + /// Read a boolean value from the stream. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + Boolean ReadBoolean( String^ fieldName ); + + /// <summary> + /// Read a char value from the stream. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + Char ReadChar( String^ fieldName ); + + /// <summary> + /// Read a 16-bit integer from the stream. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + short ReadShort( String^ fieldName ); + + /// <summary> + /// Read a 32-bit integer from the stream. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + Int32 ReadInt( String^ fieldName ); + + /// <summary> + /// Read a 64-bit integer from the stream. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + Int64 ReadLong( String^ fieldName ); + + /// <summary> + /// Read a floating point number from the stream. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + float ReadFloat( String^ fieldName ); + + /// <summary> + /// Read a double precision number from the stream. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + double ReadDouble( String^ fieldName ); + + /// <summary> + /// Read a string after java-modified UTF-8 decoding from the stream. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + String^ ReadString( String^ fieldName ); + + /// <summary> + /// Read a serializable object from the data. Null objects are handled. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + Object^ ReadObject( String^ fieldName ); + + //TODO: + //void WriteMap( String^ fieldName, System::Collections::IDictionary^ map ); + + /// <summary> + /// Read a Date from the data. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + System::DateTime ReadDate( String^ fieldName) ; + //void writeFile(String fieldName, File file) ; + + /// <summary> + /// Read a boolean array from the data. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + array<Boolean>^ ReadBooleanArray( String^ fieldName ); + + /// <summary> + /// Read a char array from the data. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + array<Char>^ ReadCharArray(String^ fieldName ); + + /// <summary> + /// Read a signed byte array from the data. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + array<Byte>^ ReadByteArray(String^ fieldName); + + /// <summary> + /// Read a short from the data. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + array<short>^ ReadShortArray(String^ fieldName); + + /// <summary> + /// Read a int array from the data. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + array<System::Int32>^ ReadIntArray(String^ fieldName); + + /// <summary> + /// Read a long array from the data. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + array<Int64>^ ReadLongArray(String^ fieldName); + + /// <summary> + /// Read a float from the data. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + array<float>^ ReadFloatArray(String^ fieldName); + + /// <summary> + /// Read a double array from the data. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + array<double>^ ReadDoubleArray(String^ fieldName); + + /// <summary> + /// Read a string array from the data. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + array<String^>^ ReadStringArray(String^ fieldName); + + /// <summary> + /// Read a object array from the data. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + List<Object^>^ ReadObjectArray(String^ fieldName); + + /// <summary> + /// Read a two-dimenesional signed byte array from the data. + /// </summary> + /// <param name="fieldName">The name of a member field whose value to read.</param> + array<array<Byte>^>^ ReadArrayOfByteArrays(String^ fieldName ); + + //TODO: + //void WriteEnum(String^ fieldName, Enum e) ; + //void WriteInetAddress(String^ fieldName, InetAddress address); + + /// <summary> + /// Whether field is available or not. + /// </summary> + /// <param name="fieldName">The name of a member field.</param> + bool HasField(String^ fieldName); + + /// <summary> + /// Whether field is used as identity field or not. + /// </summary> + /// <param name="fieldName">The name of a member field.</param> + bool IsIdentityField(String^ fieldName); + + /// <summary> + /// To preserve unread data, which get added in new version of type. + /// </summary> + /// <return>Unread data.</return> + IPdxUnreadFields^ ReadUnreadFields(); + + /// <summary> + /// Reads the named field of Type "type" and returns its value. + /// </summary> + /// <param name="fieldName">The name of a member field.</param> + /// <param name="type">The type of a member field, which value needs to read.</param> + Object^ ReadField(String^ fieldName, Type^ type); + }; + } // namespace Client + } // namespace Geode +} // namespace Apache +
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxSerializable.hpp ---------------------------------------------------------------------- diff --git a/clicache/src/IPdxSerializable.hpp b/clicache/src/IPdxSerializable.hpp new file mode 100644 index 0000000..9c8865a --- /dev/null +++ b/clicache/src/IPdxSerializable.hpp @@ -0,0 +1,67 @@ +/* + * 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 "geode_defs.hpp" +#include "IPdxWriter.hpp" +#include "IPdxReader.hpp" + +namespace Apache +{ + namespace Geode + { + namespace Client + { + + /// <summary> + /// When a domain class implements PdxSerializable it marks + /// itself as a PDX. + /// The implementation of toData provides the serialization + /// code and fromData provides the deserialization code. + /// These methods also define each field name and field type + /// of the PDX. Domain classes should serialize and de-serialize + /// all its member fields in same order in toData and fromData + /// method. + /// A domain class which implements this interface should register delgate <see cref="Serializable.RegisterPdxType" /> to create new + /// instance of type for de-serilization. + /// </summary> + public interface class IPdxSerializable + { + public: + + /// <summary> + /// Serializes this object in geode PDX format. + /// </summary> + /// <param name="writer"> + /// the IPdxWriter object to use for serializing the object + /// </param> + void ToData(IPdxWriter^ writer); + + /// <summary> + /// Deserialize this object. + /// </summary> + /// <param name="reader"> + /// the IPdxReader stream to use for reading the object data + /// </param> + void FromData(IPdxReader^ reader); + + }; + } // namespace Client + } // namespace Geode +} // namespace Apache + http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxSerializer.hpp ---------------------------------------------------------------------- diff --git a/clicache/src/IPdxSerializer.hpp b/clicache/src/IPdxSerializer.hpp new file mode 100755 index 0000000..672c176 --- /dev/null +++ b/clicache/src/IPdxSerializer.hpp @@ -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. + */ + +#pragma once + +#include "geode_defs.hpp" +#include "IPdxWriter.hpp" +#include "IPdxReader.hpp" + +namespace Apache +{ + namespace Geode + { + namespace Client + { + + /// <summary> + /// The IPdxSerializer interface allows domain classes to be + /// serialized and deserialized as PDXs without modification + /// of the domain class. + /// A domain class should register delgate <see cref="Serializable.RegisterPdxType" /> to create new + /// instance of type for de-serilization. + /// </summary> + public interface class IPdxSerializer + { + public: + + /// <summary> + /// Serializes this object in geode PDX format. + /// </summary> + /// <param name="o"> + /// the object which need to serialize + /// </param> + /// <param name="writer"> + /// the IPdxWriter object to use for serializing the object + /// </param> + bool ToData(Object^ o, IPdxWriter^ writer); + + /// <summary> + /// Deserialize this object. + /// </summary> + /// <param name="classname"> + /// the classname whose object need to de-serialize + /// </param> + /// <param name="reader"> + /// the IPdxReader stream to use for reading the object data + /// </param> + Object^ FromData(String^ classname, IPdxReader^ reader); + + }; + } // namespace Client + } // namespace Geode +} // namespace Apache + http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxTypeMapper.hpp ---------------------------------------------------------------------- diff --git a/clicache/src/IPdxTypeMapper.hpp b/clicache/src/IPdxTypeMapper.hpp new file mode 100755 index 0000000..f2b5fd6 --- /dev/null +++ b/clicache/src/IPdxTypeMapper.hpp @@ -0,0 +1,52 @@ +/* + * 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 +using namespace System; +using namespace System::Collections::Generic; +namespace Apache +{ + namespace Geode + { + namespace Client + { + + /// <summary> + /// Application can implement this interface to map pdx type name to local type name. + /// Need to set this using <see cref="Serializable.SetPdxTypeMapper" /> + /// </summary> + public interface class IPdxTypeMapper + { + public: + /// <summary> + /// To map the local type name to pdx type + /// <param name="localTypeName"> local type name </param> + /// @return the pdx type name. + /// </summary> + String^ ToPdxTypeName(String^ localTypeName); + + /// <summary> + /// To map the pdx type name to local type + /// <param name="pdxTypeName"> pdx type name </param> + /// @return the local type name. + /// </summary> + String^ FromPdxTypeName(String^ pdxTypeName); + }; + } // namespace Client + } // namespace Geode +} // namespace Apache + http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxUnreadFields.hpp ---------------------------------------------------------------------- diff --git a/clicache/src/IPdxUnreadFields.hpp b/clicache/src/IPdxUnreadFields.hpp new file mode 100644 index 0000000..96c57aa --- /dev/null +++ b/clicache/src/IPdxUnreadFields.hpp @@ -0,0 +1,40 @@ +/* + * 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 + + +namespace Apache +{ + namespace Geode + { + namespace Client + { + + /// <summary> + /// Serialize the data in geode Portable Data eXchange(Pdx) Format. + /// This format provides class versioning(forward and backward compability of types) in cache. + /// This provides ability to query .NET domian objects. + /// </summary> + public interface class IPdxUnreadFields + { + + }; + } // namespace Client + } // namespace Geode +} // namespace Apache + http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxWriter.hpp ---------------------------------------------------------------------- diff --git a/clicache/src/IPdxWriter.hpp b/clicache/src/IPdxWriter.hpp new file mode 100644 index 0000000..3196efe --- /dev/null +++ b/clicache/src/IPdxWriter.hpp @@ -0,0 +1,247 @@ +/* + * 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 "geode_defs.hpp" +//#include "IRegion.hpp" +#include "IPdxUnreadFields.hpp" +using namespace System; +using namespace System::Collections::Generic; +namespace Apache +{ + namespace Geode + { + namespace Client + { + + /// <summary> + /// A IPdxWriter will be passed to IPdxSerializable.toData + /// when it is serializing the domain class. The domain class needs to serialize member + /// fields using this interface. This interface is implemented + /// by Native Client. + /// </summary> + public interface class IPdxWriter + { + public: + + /// <summary> + /// Write a byte to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="value">The byte to write.</param> + IPdxWriter^ WriteByte( String^ fieldName, SByte value ); + + /// <summary> + /// Write a boolean value to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="value">The boolean value to write.</param> + IPdxWriter^ WriteBoolean( String^ fieldName, Boolean value ); + + /// <summary> + /// Write a char value to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="value">The char value to write.</param> + IPdxWriter^ WriteChar( String^ fieldName, Char value ); + + /// <summary> + /// Write a 16-bit integer to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="value">The 16-bit integer to write.</param> + IPdxWriter^ WriteShort( String^ fieldName, Int16 value ); + + /// <summary> + /// Write a 32-bit integer to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="value">The 32-bit integer to write.</param> + IPdxWriter^ WriteInt( String^ fieldName, Int32 value ); + + /// <summary> + /// Write a 64-bit integer to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="value">The 64-bit integer to write.</param> + IPdxWriter^ WriteLong( String^ fieldName, Int64 value ); + + /// <summary> + /// Write a float to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="value">The float value to write.</param> + IPdxWriter^ WriteFloat( String^ fieldName, float value ); + + /// <summary> + /// Write a double precision real number to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="value"> + /// The double precision real number to write. + /// </param> + IPdxWriter^ WriteDouble( String^ fieldName, double value ); + + /// <summary> + /// Write a string using java-modified UTF-8 encoding to + /// <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="value">The UTF encoded string to write.</param> + IPdxWriter^ WriteString( String^ fieldName, String^ value ); + + /// <summary> + /// Write an <c>Object</c> object to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="obj">The object to write.</param> + IPdxWriter^ WriteObject( String^ fieldName, Object^ obj ); + + //TODO: + //IPdxWriter^ WriteMap( String^ fieldName, System::Collections::IDictionary^ map ); + + /// <summary> + /// Write an collection to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="date">The date to write.</param> + IPdxWriter^ WriteDate( String^ fieldName, System::DateTime date); + + //TODO: + //IPdxWriter^ writeFile(String fieldName, File file) ; + + /// <summary> + /// Write an collection to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="boolArray">The boolArray to write.</param> + IPdxWriter^ WriteBooleanArray( String^ fieldName, array<bool>^ boolArray); + + /// <summary> + /// Write an collection to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="charArray">The charArray to write.</param> + IPdxWriter^ WriteCharArray(String^ fieldName, array<Char>^ charArray) ; + + /// <summary> + /// Write an collection to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="byteArray">The byteArray to write.</param> + IPdxWriter^ WriteByteArray(String^ fieldName, array<Byte>^ byteArray) ; + + /// <summary> + /// Write an collection to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="shortArray">The shortArray to write.</param> + IPdxWriter^ WriteShortArray(String^ fieldName, array<System::Int16>^ shortArray); + + /// <summary> + /// Write an collection to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="intArray">The intArray to write.</param> + IPdxWriter^ WriteIntArray(String^ fieldName, array<System::Int32>^ intArray); + + /// <summary> + /// Write an collection to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="longArray">The longArray to write.</param> + IPdxWriter^ WriteLongArray(String^ fieldName, array<Int64>^ longArray); + + /// <summary> + /// Write an collection to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="floatArray">The floatArray to write.</param> + IPdxWriter^ WriteFloatArray(String^ fieldName, array<float>^ floatArray); + + /// <summary> + /// Write an collection to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="doubleArray">The doubleArray to write.</param> + IPdxWriter^ WriteDoubleArray(String^ fieldName, array<double>^ doubleArray); + + /// <summary> + /// Write an collection to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="stringArray">The stringArray to write.</param> + IPdxWriter^ WriteStringArray(String^ fieldName, array<String^>^ stringArray); + + /// <summary> + /// Write an collection to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="objectArray">The objectArray to write.</param> + IPdxWriter^ WriteObjectArray(String^ fieldName, List<Object^>^ objectArray); + + /// <summary> + /// Write an collection to the <c>IPdxWriter</c>. + /// </summary> + /// <param name="fieldName">The name of the field associated with the value.</param> + /// <param name="byteArrays">The byteArrays to write.</param> + IPdxWriter^ WriteArrayOfByteArrays(String^ fieldName, array<array<Byte>^>^ byteArrays); + + //TODO: + //IPdxWriter^ WriteEnum(String^ fieldName, Enum e) ; + //IPdxWriter^ WriteInetAddress(String^ fieldName, InetAddress address); + + /// <summary> + /// Indicate that the given field name should be included in hashCode and equals checks + /// of this object on a server that is using {@link CacheFactory#setPdxReadSerialized(boolean)} + /// or when a client executes a query on a server. + /// + /// The fields that are marked as identity fields are used to generate the hashCode and + /// equals methods of {@link PdxInstance}. Because of this, the identity fields should themselves + /// either be primatives, or implement hashCode and equals. + /// + /// If no fields are set as identity fields, then all fields will be used in hashCode and equals + /// checks. + /// + /// The identity fields should make marked after they are written using a write* method. + /// </summary> + /// <param name="fieldName"> the name of the field that should be used in the as part of the identity.</param> + /// <returns>this PdxWriter</returns> + + IPdxWriter^ MarkIdentityField(String^ fieldName); + + /// <summary> + /// To append unread data with updated data. + /// + /// </summary> + /// <returns>this PdxWriter</returns> + IPdxWriter^ WriteUnreadFields(IPdxUnreadFields^ unread); + + /// <summary> + /// Writes the named field with the given value and type to the serialized form. + /// This method uses the <code>fieldType</code> to determine which WriteXXX method it should call. + /// If it can not find a specific match to a writeXXX method it will call <see cref="WriteObject(String^, Object^)">. + /// + /// </summary> + /// <returns>this PdxWriter</returns> + IPdxWriter^ WriteField(String^ fieldName, Object^ fieldValue, Type^ type); + }; + } // namespace Client + } // namespace Geode +} // namespace Apache + http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPersistenceManager.hpp ---------------------------------------------------------------------- diff --git a/clicache/src/IPersistenceManager.hpp b/clicache/src/IPersistenceManager.hpp new file mode 100644 index 0000000..b901114 --- /dev/null +++ b/clicache/src/IPersistenceManager.hpp @@ -0,0 +1,106 @@ +/* + * 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 "geode_defs.hpp" +#include "IRegion.hpp" +#include "Properties.hpp" +using namespace System; +namespace Apache +{ + namespace Geode + { + namespace Client + { + + /// <summary> + /// IPersistenceManager interface for persistence and overflow. + /// This class abstracts the disk-related operations in case of persistence or overflow to disk. + /// A specific disk storage implementation will implement all the methods described here. + /// </summary> + generic<class TKey, class TValue> + public interface class IPersistenceManager + { + public: + /// <summary> + /// Called after an implementation object is created. Initializes all the implementation + /// specific environments needed. + /// </summary> + /// <param name="region"> + /// Region for which this PersistenceManager is initialized. + /// </param> + /// <param name="diskProperties"> + /// Configuration Properties used by PersistenceManager implementation. + /// </param> + void Init(IRegion<TKey, TValue>^ region, Properties<String^, String^>^ diskProperties); + + /// <summary> + /// Writes a key, value pair of region to the disk. The actual file or database related write operations should be implemented + /// in this method by the class implementing this method. + /// </summary> + /// <param name="key"> + /// the key to write. + /// </param> + /// <param name="value"> + /// the value to write. + /// </param> + void Write(TKey key, TValue value); + + /// <summary> + /// Writes all the entries for a region. Refer persistance requirement doc for the use case. + /// </summary> + /// <returns> + /// true if WriteAll is successful. + /// </returns> + bool WriteAll(); + + /// <summary> + /// Reads the value for the key from the disk. + /// </summary> + /// <param name="key"> + /// key for which the value has to be read. + /// </param> + TValue Read(TKey key); + + /// <summary> + /// Reads all the values from the region. + /// </summary> + /// <returns> + /// true if ReadAll is successful. + /// </returns> + bool ReadAll(); + + /// <summary> + /// Destroys the entry specified by the key in the argument. + /// </summary> + /// <param name="key"> + /// key of the entry which is being destroyed. + /// </param> + void Destroy(TKey key); + + /// <summary> + /// Closes the persistence manager instance. + /// </summary> + void Close(); + + }; + } // namespace Client + } // namespace Geode +} // namespace Apache +