diff options
author | Gabor X Toth <*@tg-x.net> | 2015-05-07 12:15:58 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2015-05-07 12:15:58 +0000 |
commit | 4725d59b468f1f30ba2910992333ca157682ce29 (patch) | |
tree | 23715ee20879c94a3363e28ea184370a4a71e44d /src/include/gnunet_social_service.h | |
parent | a5edf8ac9f03a368c87ea6163994d4ac3d62af06 (diff) | |
download | gnunet-4725d59b468f1f30ba2910992333ca157682ce29.tar.gz gnunet-4725d59b468f1f30ba2910992333ca157682ce29.zip |
psyc/social: request history & state from psycstore; more documentation, tests, cleanup
Diffstat (limited to 'src/include/gnunet_social_service.h')
-rw-r--r-- | src/include/gnunet_social_service.h | 141 |
1 files changed, 89 insertions, 52 deletions
diff --git a/src/include/gnunet_social_service.h b/src/include/gnunet_social_service.h index fcfc8a359..a17446cf5 100644 --- a/src/include/gnunet_social_service.h +++ b/src/include/gnunet_social_service.h | |||
@@ -749,9 +749,45 @@ GNUNET_SOCIAL_guest_get_place (struct GNUNET_SOCIAL_Guest *guest); | |||
749 | 749 | ||
750 | 750 | ||
751 | /** | 751 | /** |
752 | * A history lesson. | 752 | * A history request. |
753 | */ | 753 | */ |
754 | struct GNUNET_SOCIAL_HistoryLesson; | 754 | struct GNUNET_SOCIAL_HistoryRequest; |
755 | |||
756 | |||
757 | /** | ||
758 | * Learn about the history of a place. | ||
759 | * | ||
760 | * Messages are returned through the @a slicer function | ||
761 | * and have the #GNUNET_PSYC_MESSAGE_HISTORIC flag set. | ||
762 | * | ||
763 | * @param place | ||
764 | * Place we want to learn more about. | ||
765 | * @param start_message_id | ||
766 | * First historic message we are interested in. | ||
767 | * @param end_message_id | ||
768 | * Last historic message we are interested in (inclusive). | ||
769 | * @param method_prefix | ||
770 | * Only retrieve messages with this method prefix. | ||
771 | * @param flags | ||
772 | * OR'ed GNUNET_PSYC_HistoryReplayFlags | ||
773 | * @param slicer | ||
774 | * Slicer to use for retrieved messages. | ||
775 | * Can be the same as the slicer of the place. | ||
776 | * @param result_cb | ||
777 | * Function called after all messages retrieved. | ||
778 | * NULL if not needed. | ||
779 | * @param cls Closure for @a result_cb. | ||
780 | */ | ||
781 | struct GNUNET_SOCIAL_HistoryRequest * | ||
782 | GNUNET_SOCIAL_place_history_replay (struct GNUNET_SOCIAL_Place *plc, | ||
783 | uint64_t start_message_id, | ||
784 | uint64_t end_message_id, | ||
785 | const char *method_prefix, | ||
786 | uint32_t flags, | ||
787 | struct GNUNET_SOCIAL_Slicer *slicer, | ||
788 | GNUNET_ResultCallback result_cb, | ||
789 | void *cls); | ||
790 | |||
755 | 791 | ||
756 | /** | 792 | /** |
757 | * Learn about the history of a place. | 793 | * Learn about the history of a place. |
@@ -762,36 +798,32 @@ struct GNUNET_SOCIAL_HistoryLesson; | |||
762 | * | 798 | * |
763 | * To get the latest message, use 0 for both the start and end message ID. | 799 | * To get the latest message, use 0 for both the start and end message ID. |
764 | * | 800 | * |
765 | * @param place Place we want to learn more about. | 801 | * @param place |
766 | * @param start_message_id First historic message we are interested in. | 802 | * Place we want to learn more about. |
767 | * @param end_message_id Last historic message we are interested in (inclusive). | 803 | * @param message_limit |
768 | * @param slicer Slicer to use to process history. Can be the same as the | 804 | * Maximum number of historic messages we are interested in. |
769 | * slicer of the place, as the HISTORIC flag allows distinguishing | 805 | * @param result_cb |
770 | * old messages from fresh ones. | 806 | * Function called after all messages retrieved. |
771 | * @param finish_cb Function called after the last message in the history lesson | 807 | * NULL if not needed. |
772 | * is passed through the @a slicer. NULL if not needed. | 808 | * @param cls Closure for @a result_cb. |
773 | * @param finish_cb_cls Closure for @a finish_cb. | ||
774 | * @return Handle to abort history lesson, never NULL (multiple lessons | ||
775 | * at the same time are allowed). | ||
776 | */ | 809 | */ |
777 | struct GNUNET_SOCIAL_HistoryLesson * | 810 | struct GNUNET_SOCIAL_HistoryRequest * |
778 | GNUNET_SOCIAL_place_get_history (struct GNUNET_SOCIAL_Place *place, | 811 | GNUNET_SOCIAL_place_history_replay_latest (struct GNUNET_SOCIAL_Place *plc, |
779 | uint64_t start_message_id, | 812 | uint64_t message_limit, |
780 | uint64_t end_message_id, | 813 | const char *method_prefix, |
781 | const struct GNUNET_SOCIAL_Slicer *slicer, | 814 | uint32_t flags, |
782 | void (*finish_cb)(void *), | 815 | struct GNUNET_SOCIAL_Slicer *slicer, |
783 | void *finish_cb_cls); | 816 | GNUNET_ResultCallback result_cb, |
784 | 817 | void *cls); | |
785 | 818 | ||
786 | /** | 819 | /** |
787 | * Stop processing messages from the history lesson. | 820 | * Cancel learning about the history of a place. |
788 | * | ||
789 | * Must not be called after the finish callback of the history lesson is called. | ||
790 | * | 821 | * |
791 | * @param hist History lesson to cancel. | 822 | * @param hist |
823 | * History lesson to cancel. | ||
792 | */ | 824 | */ |
793 | void | 825 | void |
794 | GNUNET_SOCIAL_place_get_history_cancel (struct GNUNET_SOCIAL_HistoryLesson *hist); | 826 | GNUNET_SOCIAL_place_history_replay_cancel (struct GNUNET_SOCIAL_HistoryRequest *hist); |
795 | 827 | ||
796 | 828 | ||
797 | struct GNUNET_SOCIAL_WatchHandle; | 829 | struct GNUNET_SOCIAL_WatchHandle; |
@@ -803,7 +835,7 @@ struct GNUNET_SOCIAL_WatchHandle; | |||
803 | * Place to watch. | 835 | * Place to watch. |
804 | * @param object_filter | 836 | * @param object_filter |
805 | * Object prefix to match. | 837 | * Object prefix to match. |
806 | * @param state_var_cb | 838 | * @param var_cb |
807 | * Function to call when an object/state var changes. | 839 | * Function to call when an object/state var changes. |
808 | * @param cls | 840 | * @param cls |
809 | * Closure for callback. | 841 | * Closure for callback. |
@@ -813,7 +845,7 @@ struct GNUNET_SOCIAL_WatchHandle; | |||
813 | struct GNUNET_SOCIAL_WatchHandle * | 845 | struct GNUNET_SOCIAL_WatchHandle * |
814 | GNUNET_SOCIAL_place_watch (struct GNUNET_SOCIAL_Place *place, | 846 | GNUNET_SOCIAL_place_watch (struct GNUNET_SOCIAL_Place *place, |
815 | const char *object_filter, | 847 | const char *object_filter, |
816 | GNUNET_PSYC_StateVarCallback state_var_cb, | 848 | GNUNET_PSYC_StateVarCallback var_cb, |
817 | void *cls); | 849 | void *cls); |
818 | 850 | ||
819 | 851 | ||
@@ -830,13 +862,35 @@ struct GNUNET_SOCIAL_LookHandle; | |||
830 | 862 | ||
831 | 863 | ||
832 | /** | 864 | /** |
833 | * Look at objects in the place with a matching name prefix. | 865 | * Look at a particular object in the place. |
866 | * | ||
867 | * The best matching object is returned (its name might be less specific than | ||
868 | * what was requested). | ||
869 | * | ||
870 | * @param place | ||
871 | * The place to look the object at. | ||
872 | * @param full_name | ||
873 | * Full name of the object. | ||
874 | * @param value_size | ||
875 | * Set to the size of the returned value. | ||
876 | * | ||
877 | * @return NULL if there is no such object at this place. | ||
878 | */ | ||
879 | struct GNUNET_SOCIAL_LookHandle * | ||
880 | GNUNET_SOCIAL_place_look_at (struct GNUNET_SOCIAL_Place *plc, | ||
881 | const char *full_name, | ||
882 | GNUNET_PSYC_StateVarCallback var_cb, | ||
883 | GNUNET_ResultCallback result_cb, | ||
884 | void *cls); | ||
885 | |||
886 | /** | ||
887 | * Look for objects in the place with a matching name prefix. | ||
834 | * | 888 | * |
835 | * @param place | 889 | * @param place |
836 | * The place to look its objects at. | 890 | * The place to look its objects at. |
837 | * @param name_prefix | 891 | * @param name_prefix |
838 | * Look at objects with names beginning with this value. | 892 | * Look at objects with names beginning with this value. |
839 | * @param state_var_cb | 893 | * @param var_cb |
840 | * Function to call for each object found. | 894 | * Function to call for each object found. |
841 | * @param cls | 895 | * @param cls |
842 | * Closure for callback function. | 896 | * Closure for callback function. |
@@ -844,10 +898,11 @@ struct GNUNET_SOCIAL_LookHandle; | |||
844 | * @return Handle that can be used to stop looking at objects. | 898 | * @return Handle that can be used to stop looking at objects. |
845 | */ | 899 | */ |
846 | struct GNUNET_SOCIAL_LookHandle * | 900 | struct GNUNET_SOCIAL_LookHandle * |
847 | GNUNET_SOCIAL_place_look (struct GNUNET_SOCIAL_Place *place, | 901 | GNUNET_SOCIAL_place_look_for (struct GNUNET_SOCIAL_Place *plc, |
848 | const char *name_prefix, | 902 | const char *name_prefix, |
849 | GNUNET_PSYC_StateVarCallback state_var_cb, | 903 | GNUNET_PSYC_StateVarCallback var_cb, |
850 | void *cls); | 904 | GNUNET_ResultCallback result_cb, |
905 | void *cls); | ||
851 | 906 | ||
852 | 907 | ||
853 | /** | 908 | /** |
@@ -859,24 +914,6 @@ void | |||
859 | GNUNET_SOCIAL_place_look_cancel (struct GNUNET_SOCIAL_LookHandle *lh); | 914 | GNUNET_SOCIAL_place_look_cancel (struct GNUNET_SOCIAL_LookHandle *lh); |
860 | 915 | ||
861 | 916 | ||
862 | |||
863 | /** | ||
864 | * Look at a particular object in the place. | ||
865 | * | ||
866 | * The best matching object is returned (its name might be less specific than | ||
867 | * what was requested). | ||
868 | * | ||
869 | * @param place The place to look the object at. | ||
870 | * @param full_name Full name of the object. | ||
871 | * @param value_size Set to the size of the returned value. | ||
872 | * @return NULL if there is no such object at this place. | ||
873 | */ | ||
874 | const void * | ||
875 | GNUNET_SOCIAL_place_look_at (struct GNUNET_SOCIAL_Place *place, | ||
876 | const char *full_name, | ||
877 | size_t *value_size); | ||
878 | |||
879 | |||
880 | #if 0 /* keep Emacsens' auto-indent happy */ | 917 | #if 0 /* keep Emacsens' auto-indent happy */ |
881 | { | 918 | { |
882 | #endif | 919 | #endif |