Vault API question: knownServerRevision param for .Refresh

This forum is now locked, since Gold Support is no longer offered.

Moderator: SourceGear

Locked
dking513
Posts: 48
Joined: Tue Apr 20, 2004 3:23 pm

Vault API question: knownServerRevision param for .Refresh

Post by dking513 » Sun Oct 17, 2004 5:27 pm

I would like to use the knownServerRevision parameter when perfoming the .Refresh method of the ClientInstance. The only problem is, where can I get the value for the last knownServerRevision for the local cache?

Thanks,
Dave King

sterwill
Posts: 256
Joined: Thu Nov 06, 2003 10:01 am
Location: SourceGear

Post by sterwill » Mon Oct 18, 2004 8:53 am

You almost always want to set knownServerRevision to -1 when calling ClientInstance.Refresh(). The purpose of this parameter is to allow the Refresh call to skip the network hit if knownServerRevision is the revision the tree cache is already at, if the value you passed was not -1. You would only pass in a different value if you had just previously found out the latest version of the repository tree (through some other communications with the server) and wanted to keep network traffic to an absolute minimum.
Shaw Terwilliger
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`

dking513
Posts: 48
Joined: Tue Apr 20, 2004 3:23 pm

Won't a value of -1 hit the server every time?

Post by dking513 » Tue Oct 19, 2004 9:37 am

I DO want to keep network traffic to a minimum. That's what I'm trying to figure out. Refresh seems to send the server tree data even if my cache is up to date. What I'm trying to determine is how to avoid this. How do I determine the version of my local cache so that I only fetch data when necessary?

sterwill
Posts: 256
Joined: Thu Nov 06, 2003 10:01 am
Location: SourceGear

Post by sterwill » Tue Oct 19, 2004 10:23 am

I don't think the problem you're trying to solve is related to this parameter. If a tree delta is being transferred even when you're up-to-date, it's probably a different problem. Do you have a large number of shared items in the repository? Refresh must contact the server every time it's called, or else it can't ever determine whether the server has newer data.

A bit of history on the knownServerRevision parameter:

This parameter is for when you know the server's most recent version of the repository, not your local client's version. The Refresh function that takes knownServerRevision is mostly useless, and it's not used by any modern Vault clients. It was originally written to let clients call Refresh more often right after they've logged in (when they learn the latest repository version from GetRepositoryList). It will be removed in a future release of Vault, because the design pattern wasn't found to be useful.

If you want to know what your local tree cache's version is, you can simple read clientInstance.Repository.RevID.
Shaw Terwilliger
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`

Locked