java.lang.Object
it.auties.whatsapp.controller.ProtobufControllerSerializer
- All Implemented Interfaces:
ControllerSerializer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConcurrentMap<UUID, CompletableFuture<Void>> private final Pathprivate LinkedList<PhoneNumber> private LinkedList<UUID> private static final Stringprivate static final Pathprivate static final Stringprivate static final Stringprivate static final Map<Path, ProtobufControllerSerializer> private static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionattributeStore(Store store) Attributes the store asynchronously.private voidattributeStoreContextInfo(Store store, ContextInfo contextInfo) private voidattributeStoreContextualMessage(Store store, HistorySyncMessage message) private voidprivate voidvoiddeleteSession(Controller<?> controller) Deletes a sessionprivate voiddeserializeChat(Store store, Path chatFile) deserializeKeys(ClientType type, long phoneNumber) Serializes the keysdeserializeKeys(ClientType type, String alias) Serializes the keysdeserializeKeys(ClientType type, UUID id) Serializes the keysdeserializeKeysFromId(ClientType type, String id) private voiddeserializeNewsletter(Store store, Path newsletterFile) deserializeStore(ClientType type, long phoneNumber) Serializes the storedeserializeStore(ClientType type, String alias) Serializes the storedeserializeStore(ClientType type, UUID id) Serializes the storedeserializeStoreFromId(ClientType type, String id) private PathgetHome(ClientType type) private FileTimegetLastModifiedTime(Path path) private PathgetSessionDirectory(ClientType clientType, String path) private PathgetSessionFile(ClientType clientType, String uuid, String fileName) private PathgetSessionFile(Store store, String fileName) private CompletableFuture<Void> handleStoreFile(Store store, Path entry) voidlinkMetadata(Controller<?> controller) Creates a link between the session and its metadata, usually phone number and aliasprivate voidlinkToUuid(ClientType type, UUID uuid, String string) listIds(ClientType type) Returns all the known IDslistPhoneNumbers(ClientType type) Returns all the known IDsstatic ControllerSerializerstatic ControllerSerializerprivate VoidparsePathAsId(Path file) private Optional<PhoneNumber> parsePathAsPhoneNumber(Path file) private ChatrescueChat(Path entry) private it.auties.whatsapp.model.newsletter.NewsletterrescueNewsletter(Path entry) private CompletableFuture<Void> serializeChatAsync(Store store, Chat chat) private CompletableFuture<?>[]serializeChatsAsync(Store store) serializeKeys(Keys keys, boolean async) Serializes the keysprivate CompletableFuture<Void> serializeNewsletterAsync(Store store, it.auties.whatsapp.model.newsletter.Newsletter newsletter) private CompletableFuture<?>[]serializeNewslettersAsync(Store store) serializeStore(Store store, boolean async) Serializes the storeprivate voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface it.auties.whatsapp.controller.ControllerSerializer
deserializeStoreKeysPair, newStoreKeysPair
-
Field Details
-
DEFAULT_SERIALIZER_PATH
-
CHAT_PREFIX
- See Also:
-
NEWSLETTER_PREFIX
- See Also:
-
STORE_NAME
- See Also:
-
KEYS_NAME
- See Also:
-
serializers
-
baseDirectory
-
attributeStoreSerializers
-
cachedUuids
-
cachedPhoneNumbers
-
-
Constructor Details
-
ProtobufControllerSerializer
-
-
Method Details
-
ofDefaultPath
-
of
-
listIds
Description copied from interface:ControllerSerializerReturns all the known IDs- Specified by:
listIdsin interfaceControllerSerializer- Parameters:
type- the non-null type of client- Returns:
- a non-null linked list
-
listPhoneNumbers
Description copied from interface:ControllerSerializerReturns all the known IDs- Specified by:
listPhoneNumbersin interfaceControllerSerializer- Parameters:
type- the non-null type of client- Returns:
- a non-null linked list
-
getLastModifiedTime
-
parsePathAsId
-
parsePathAsPhoneNumber
-
serializeKeys
Description copied from interface:ControllerSerializerSerializes the keys- Specified by:
serializeKeysin interfaceControllerSerializer- Parameters:
keys- the non-null keys to serializeasync- whether the operation should be executed asynchronously
-
serializeStore
Description copied from interface:ControllerSerializerSerializes the store- Specified by:
serializeStorein interfaceControllerSerializer- Parameters:
store- the non-null store to serializeasync- whether the operation should be executed asynchronously
-
serializeChatsAsync
-
serializeChatAsync
-
onError
-
serializeNewslettersAsync
-
serializeNewsletterAsync
private CompletableFuture<Void> serializeNewsletterAsync(Store store, it.auties.whatsapp.model.newsletter.Newsletter newsletter) -
writeFile
-
deserializeKeys
Description copied from interface:ControllerSerializerSerializes the keys- Specified by:
deserializeKeysin interfaceControllerSerializer- Parameters:
type- the non-null type of clientid- the id of the keys- Returns:
- a non-null keys
-
deserializeKeys
Description copied from interface:ControllerSerializerSerializes the keys- Specified by:
deserializeKeysin interfaceControllerSerializer- Parameters:
type- the non-null type of clientalias- the alias number of the keys- Returns:
- a non-null keys
-
deserializeKeys
Description copied from interface:ControllerSerializerSerializes the keys- Specified by:
deserializeKeysin interfaceControllerSerializer- Parameters:
type- the non-null type of clientphoneNumber- the phone number of the keys- Returns:
- a non-null keys
-
deserializeKeysFromId
-
deserializeStore
Description copied from interface:ControllerSerializerSerializes the store- Specified by:
deserializeStorein interfaceControllerSerializer- Parameters:
type- the non-null type of clientid- the id of the store- Returns:
- a non-null store
-
deserializeStore
Description copied from interface:ControllerSerializerSerializes the store- Specified by:
deserializeStorein interfaceControllerSerializer- Parameters:
type- the non-null type of clientalias- the alias of the store- Returns:
- a non-null store
-
deserializeStore
Description copied from interface:ControllerSerializerSerializes the store- Specified by:
deserializeStorein interfaceControllerSerializer- Parameters:
type- the non-null type of clientphoneNumber- the phone number of the store- Returns:
- a non-null store
-
deserializeStoreFromId
-
attributeStore
Description copied from interface:ControllerSerializerAttributes the store asynchronously. This method is optionally used to load asynchronously heavy data such as chats while the socket is connecting. If implemented, cache the returning newsletters because the method may be called multiple times.- Specified by:
attributeStorein interfaceControllerSerializer- Parameters:
store- the non-null store to attribute- Returns:
- a completable newsletters
-
attributeStoreContextualMessages
-
attributeStoreContextualMessage
-
attributeStoreContextInfo
-
handleStoreFile
-
deleteSession
Description copied from interface:ControllerSerializerDeletes a session- Specified by:
deleteSessionin interfaceControllerSerializer- Parameters:
controller- the non-null controller
-
delete
- Throws:
IOException
-
linkMetadata
Description copied from interface:ControllerSerializerCreates a link between the session and its metadata, usually phone number and alias- Specified by:
linkMetadatain interfaceControllerSerializer- Parameters:
controller- a non-null controller
-
linkToUuid
-
deserializeChat
-
rescueChat
-
deserializeNewsletter
-
rescueNewsletter
-
getHome
-
getSessionDirectory
-
getSessionFile
-
getSessionFile
-