diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-28 15:08:13 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-28 15:08:13 +0000 |
commit | 7d9840a0500c6e8820506e3de587c5d1fd945cec (patch) | |
tree | 1e518f6303af98fbaa39e228b3ae1b498f5abea1 /src/fs/fs.h | |
parent | 6893f9fb1ae5f4569d2207e4fbf4f38cc4e849f6 (diff) | |
download | gnunet-7d9840a0500c6e8820506e3de587c5d1fd945cec.tar.gz gnunet-7d9840a0500c6e8820506e3de587c5d1fd945cec.zip |
first work on serialization
Diffstat (limited to 'src/fs/fs.h')
-rw-r--r-- | src/fs/fs.h | 73 |
1 files changed, 53 insertions, 20 deletions
diff --git a/src/fs/fs.h b/src/fs/fs.h index a6a12b9cd..8726deb6e 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h | |||
@@ -326,7 +326,8 @@ struct GNUNET_FS_FileInformation | |||
326 | 326 | ||
327 | /** | 327 | /** |
328 | * Under what filename is this struct serialized | 328 | * Under what filename is this struct serialized |
329 | * (for operational persistence). | 329 | * (for operational persistence). Should be determined |
330 | * using 'mktemp'. | ||
330 | */ | 331 | */ |
331 | char *serialization; | 332 | char *serialization; |
332 | 333 | ||
@@ -342,6 +343,12 @@ struct GNUNET_FS_FileInformation | |||
342 | char *emsg; | 343 | char *emsg; |
343 | 344 | ||
344 | /** | 345 | /** |
346 | * Filename on disk that is used to track the progress of this | ||
347 | * upload (short name, not the full path). | ||
348 | */ | ||
349 | char *serialization_name; | ||
350 | |||
351 | /** | ||
345 | * Data describing either the file or the directory. | 352 | * Data describing either the file or the directory. |
346 | */ | 353 | */ |
347 | union | 354 | union |
@@ -586,6 +593,32 @@ GNUNET_FS_search_probe_progress_ (void *cls, | |||
586 | const struct GNUNET_FS_ProgressInfo *info); | 593 | const struct GNUNET_FS_ProgressInfo *info); |
587 | 594 | ||
588 | 595 | ||
596 | /** | ||
597 | * Main function that performs the upload. | ||
598 | * | ||
599 | * @param cls "struct GNUNET_FS_PublishContext" identifies the upload | ||
600 | * @param tc task context | ||
601 | */ | ||
602 | void | ||
603 | GNUNET_FS_publish_main_ (void *cls, | ||
604 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
605 | |||
606 | |||
607 | /** | ||
608 | * Fill in all of the generic fields for a publish event and call the | ||
609 | * callback. | ||
610 | * | ||
611 | * @param pi structure to fill in | ||
612 | * @param sc overall publishing context | ||
613 | * @param p file information for the file being published | ||
614 | * @param offset where in the file are we so far | ||
615 | * @return value returned from callback | ||
616 | */ | ||
617 | void * | ||
618 | GNUNET_FS_publish_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | ||
619 | struct GNUNET_FS_PublishContext *sc, | ||
620 | const struct GNUNET_FS_FileInformation *p, | ||
621 | uint64_t offset); | ||
589 | 622 | ||
590 | /** | 623 | /** |
591 | * Master context for most FS operations. | 624 | * Master context for most FS operations. |
@@ -683,7 +716,7 @@ struct GNUNET_FS_Handle | |||
683 | 716 | ||
684 | 717 | ||
685 | /** | 718 | /** |
686 | * Handle for controlling an upload. | 719 | * Handle for controlling a publication process. |
687 | */ | 720 | */ |
688 | struct GNUNET_FS_PublishContext | 721 | struct GNUNET_FS_PublishContext |
689 | { | 722 | { |
@@ -713,15 +746,19 @@ struct GNUNET_FS_PublishContext | |||
713 | char *nuid; | 746 | char *nuid; |
714 | 747 | ||
715 | /** | 748 | /** |
716 | * Our own client handle for the FS service; | 749 | * Filename used for serializing information about this operation |
717 | * only briefly used when we start to index a | 750 | * (should be determined using 'mktemp'). |
718 | * file, otherwise NULL. | 751 | */ |
752 | char *serialization; | ||
753 | |||
754 | /** | ||
755 | * Our own client handle for the FS service; only briefly used when | ||
756 | * we start to index a file, otherwise NULL. | ||
719 | */ | 757 | */ |
720 | struct GNUNET_CLIENT_Connection *client; | 758 | struct GNUNET_CLIENT_Connection *client; |
721 | 759 | ||
722 | /** | 760 | /** |
723 | * Current position in the file-tree for the | 761 | * Current position in the file-tree for the upload. |
724 | * upload. | ||
725 | */ | 762 | */ |
726 | struct GNUNET_FS_FileInformation *fi_pos; | 763 | struct GNUNET_FS_FileInformation *fi_pos; |
727 | 764 | ||
@@ -731,23 +768,19 @@ struct GNUNET_FS_PublishContext | |||
731 | struct GNUNET_DATASTORE_Handle *dsh; | 768 | struct GNUNET_DATASTORE_Handle *dsh; |
732 | 769 | ||
733 | /** | 770 | /** |
734 | * ID of the task performing the upload. NO_TASK | 771 | * ID of the task performing the upload. NO_TASK if the upload has |
735 | * if the upload has completed. | 772 | * completed. |
736 | */ | 773 | */ |
737 | GNUNET_SCHEDULER_TaskIdentifier upload_task; | 774 | GNUNET_SCHEDULER_TaskIdentifier upload_task; |
738 | 775 | ||
739 | /** | 776 | /** |
740 | * Typically GNUNET_NO. Set to GNUNET_YES if | 777 | * Typically GNUNET_NO. Set to GNUNET_YES if "upload_task" is |
741 | * "upload_task" is GNUNET_SCHEDULER_NO_TASK | 778 | * GNUNET_SCHEDULER_NO_TASK and we're waiting for a response from |
742 | * and we're waiting for a response from the | 779 | * the datastore service (in which case this struct must not be |
743 | * datastore service (in which case this | 780 | * freed until we have that response). If someone tries to stop the |
744 | * struct must not be freed until we have that | 781 | * download for good during this period, "in_network_wait" is set to |
745 | * response). If someone tries to stop the | 782 | * GNUNET_SYSERR which will cause the struct to be destroyed right |
746 | * download for good during this period, | 783 | * after we have the reply (or timeout) from the datastore service. |
747 | * "in_network_wait" is set to GNUNET_SYSERR | ||
748 | * which will cause the struct to be destroyed | ||
749 | * right after we have the reply (or timeout) | ||
750 | * from the datastore service. | ||
751 | */ | 784 | */ |
752 | int in_network_wait; | 785 | int in_network_wait; |
753 | 786 | ||