Skip to content

Commit

Permalink
Move to an optimized version of the call
Browse files Browse the repository at this point in the history
  • Loading branch information
ayende committed Apr 25, 2012
1 parent b93c33e commit fde0d8d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Raven.Database/Storage/IAttachmentsStorageActions.cs
Expand Up @@ -18,6 +18,6 @@ public interface IAttachmentsStorageActions
void DeleteAttachment(string key, Guid? etag);
Attachment GetAttachment(string key);
IEnumerable<AttachmentInformation> GetAttachmentsByReverseUpdateOrder(int start);
IEnumerable<AttachmentInformation> GetAttachmentsAfter(Guid value);
IEnumerable<AttachmentInformation> GetAttachmentsAfter(Guid value, int take);
}
}
21 changes: 11 additions & 10 deletions Raven.Storage.Managed/AttachmentsStorageActions.cs
Expand Up @@ -110,18 +110,19 @@ public IEnumerable<AttachmentInformation> GetAttachmentsByReverseUpdateOrder(int
};
}

public IEnumerable<AttachmentInformation> GetAttachmentsAfter(Guid value)
public IEnumerable<AttachmentInformation> GetAttachmentsAfter(Guid value, int take)
{
return from key in storage.Attachments["ByEtag"]
.SkipAfter(new RavenJObject{{"etag", value.ToByteArray()}})
let attachment = GetAttachment(key.Value<string>("key"))
select new AttachmentInformation
{
Key = key.Value<string>("key"),
Etag = new Guid(key.Value<byte[]>("etag")),
Metadata = attachment.Metadata,
Size = attachment.Size
};
.SkipAfter(new RavenJObject {{"etag", value.ToByteArray()}})
.Take(take)
let attachment = GetAttachment(key.Value<string>("key"))
select new AttachmentInformation
{
Key = key.Value<string>("key"),
Etag = new Guid(key.Value<byte[]>("etag")),
Metadata = attachment.Metadata,
Size = attachment.Size
};
}
}
}

0 comments on commit fde0d8d

Please sign in to comment.