API proposal for the feed store API

Sep 8, 2010 at 9:49 PM

I posted my reply to the work item thread that Ebbo created (http://nupack.codeplex.com/workitem/5), but it seems that the thread does not surface to the top. So I create a new discussion thread.

Basically my proposal looks like this:

class PackageFeed : IEquateable<PackageFeed> {

public string Name { get; }

public Uri Uri { get; }

}

class abstract PackageFeedProvider {

public abstract IEnumerable<PackageFeed> GetFeeds();

public abstract void AddFeed(PackageFeed source);

public abstract bool RemoveFeed(PackageFeed source);

public abstract PackageFeed ActiveFeed { get; set; }

}

static class FeedStore {

public static PackageFeedProvider DefaultFeedProvider { get; set; }

public static IEnumerable<PackageFeed> GetFeeds();

public static void AddFeed(PackageFeed source);

public static bool RemoveFeed(PackageFeed source);

public static ActiveFeed { get; set; }

}

class VSFeedProvider : PackageFeedProvider {

}

Sep 9, 2010 at 1:49 AM

any feedback on this?

Coordinator
Sep 9, 2010 at 1:55 AM
I'll look at it tonight or tomorrow.

From: dotnetjunky [notifications@codeplex.com]
Sent: Wednesday, September 08, 2010 5:49 PM
To: Phil Haack
Subject: Re: API proposal for the feed store API [nupack:226519]

From: dotnetjunky

any feedback on this?

Coordinator
Sep 9, 2010 at 6:18 PM

Copying to a PRE tag so it's easier to digest. Corrected spelling of IEquatable :)

class PackageFeed : IEquatable {
  public string Name { get; }
  public Uri Uri { get; }
}

class abstract PackageFeedProvider {
  public abstract IEnumerable GetFeeds();
  public abstract void AddFeed(PackageFeed source);
  public abstract bool RemoveFeed(PackageFeed source);
  public abstract PackageFeed ActiveFeed { get; set; }
}

static class FeedStore {
  public static PackageFeedProvider DefaultFeedProvider { get; set; }
  public static IEnumerable GetFeeds();
  public static void AddFeed(PackageFeed source);
  public static bool RemoveFeed(PackageFeed source);
  public static ActiveFeed { get; set; }
}

class VSFeedProvider : PackageFeedProvider {
}

Do we even need FeedStore? Couldn't we put the DefaultFeedProvider singleton property on PackageFeedProvider itself. Ideally, we would pass the PackageFeedProvider to whomever needs it to minimize the number of places where the singleton is directly accessed. Otherwise, this looks fine.

Developer
Sep 9, 2010 at 6:35 PM
We can't assume a uri, feed is the wrong name. It should be package source, and should be a string.
>
Coordinator
Sep 9, 2010 at 6:48 PM
Great point. I forgot about the fact that the feed source can be a directory such as c:\packages or \\my-server\packages
Sep 9, 2010 at 7:25 PM

The reason I added the FeedStore class is that I want to make it dead simple for client code to call the API. So, they only need to call FeedStore.GetFeeds(), instead of PackageFeedProvider.Default.GetFeeds().

This is similar to how the ASP.Net Provider model is designed.

I don’t feel very strongly about it though. What do others think about it?

From: haacked [mailto:notifications@codeplex.com]
Sent: Thursday, September 09, 2010 10:19 AM
To: Luan Nguyen
Subject: Re: API proposal for the feed store API [nupack:226519]

From: haacked

Copying to a PRE tag so it's easier to digest. Corrected spelling of IEquatable :)

class PackageFeed : IEquatable {
  public string Name { get; }
  public Uri Uri { get; }
}
 
class abstract PackageFeedProvider {
  public abstract IEnumerable GetFeeds();
  public abstract void AddFeed(PackageFeed source);
  public abstract bool RemoveFeed(PackageFeed source);
  public abstract PackageFeed ActiveFeed { get; set; }
}
 
static class FeedStore {
  public static PackageFeedProvider DefaultFeedProvider { get; set; }
  public static IEnumerable GetFeeds();
  public static void AddFeed(PackageFeed source);
  public static bool RemoveFeed(PackageFeed source);
  public static ActiveFeed { get; set; }
}
 
class VSFeedProvider : PackageFeedProvider {
}

Do we even need FeedStore? Couldn't we put the DefaultFeedProvider singleton property on PackageFeedProvider itself. Ideally, we would pass the PackageFeedProvider to whomever needs it to minimize the number of places where the singleton is directly accessed. Otherwise, this looks fine.

Read the full discussion online.

To add a post to this discussion, reply to this email (nupack@discussions.codeplex.com)

To start a new discussion for this project, email nupack@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Sep 9, 2010 at 7:30 PM

OK, I'll change the the PackageFeed to PackageSource like this:

    public class PackageSource : IEquatable<PackageSource> {
        public string Name { get; }
        public string Source { get; }
    }
Sep 9, 2010 at 7:37 PM
They can be a uri

Great point. I forgot about the fact that the feed source can be a directory such as c:\packages or \\my-server\packages


file://c/packages
file://my-server/packages

-d
Sep 9, 2010 at 9:05 PM

Since we have the command Update-PackageSource in the console, we don’t want users to have to type “Update-PackageSource file://c/packages”. So I think using the string type in this case is the easier solution.

Developer
Sep 9, 2010 at 9:20 PM

Let's not force file uri on people, they are ugly. Even what we have now isn't technically correct since the IPackageRepository is an interface that can be implemented over any package store (Feed, DB, FileSystem).

Coordinator
Sep 9, 2010 at 9:32 PM
I don't feel strongly either way. Let's keep what you have and we can refractor later if necessary.
>
Sep 9, 2010 at 9:43 PM
people could type in C:\whatever and we could flip to a URI but that's cool.
:)
Just pointing out that most anything can be made into a URI, and we can always convert the user input into the form we need. After all, a "1" is not a 1

;)

-d

On Thu, Sep 9, 2010 at 3:05 PM, dotnetjunky <notifications@codeplex.com> wrote:

From: dotnetjunky

Since we have the command Update-PackageSource in the console, we don’t want users to have to type “Update-PackageSource file://c/packages”. So I think using the string type in this case is the easier solution.

Read the full discussion online.

To add a post to this discussion, reply to this email (nupack@discussions.codeplex.com)

To start a new discussion for this project, email nupack@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com