gpt4 book ai didi

c# - Azure block blob "staging"区域 block 过期

转载 作者:行者123 更新时间:2023-12-02 07:58:06 26 4
gpt4 key购买 nike

我使用 Azure.Storage.Blobs SDK 实现了从 Xamarin.Forms 应用程序到 Azure Blob 存储的视频上传。

要求是上传只能在应用程序处于事件状态时进行。采取的方法是使用 block 上传视频,以便我可以处理部分上传以及应用程序 sleep /唤醒时恢复上传 - 这部分已实现并正常工作。

我正在使用 BlockBlobClient.StageBlockAsync,其中文档指出“StageBlockAsync 操作创建一个新 block 作为最终提交的 block Blob 的“暂存区域”的一部分”

来源:https://learn.microsoft.com/en-us/dotnet/api/azure.storage.blobs.specialized.blockblobclient.stageblockasync?view=azure-dotnet

现在,这种方法对我来说非常有效,并给出了所需的结果,但是我似乎找不到任何提及如果未尝试提交操作,单个 block 是否会过期。

场景:应用程序有 7 个 block 要上传,3 个上传成功,然后应用程序退出 - 当应用程序恢复时,它应该上传剩余的 block 并提交它们。

如果一段时间没有打开应用,上传的区 block 会过期吗?

谢谢

最佳答案

Now this approach is working very well for me and giving the desired results, however I can't seem to find any mention of whether an individual block gets expired if a commit operation hasn't been attempted.

如果不提交,单个区 block 将在 7 天后过期。来自 REST API 文档 link :

If you call Put Block on a blob that does not yet exist, a new block blob is created with a content length of 0. This blob is enumerated by the List Blobs operation if the include=uncommittedblobs option is specified. The block or blocks that you uploaded are not committed until you call Put Block List on the new blob. A blob created this way is maintained on the server for a week; if you have not added more blocks or committed blocks to the blob within that time period, then the blob is garbage collected.

这里也提到了同样的事情:https://learn.microsoft.com/en-us/dotnet/api/azure.storage.blobs.specialized.blockblobclient?view=azure-dotnet (最后一段)。

关于c# - Azure block blob "staging"区域 block 过期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62021724/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com