Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

Commit

Permalink
MemoryStory doc tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
briandorsey committed Feb 25, 2012
1 parent a21e6d5 commit 2669aa0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
5 changes: 2 additions & 3 deletions doc/status.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Planned

* write quickstart documentation
* python client: add docs
* add API support for returning a single AppSummary or HostSummary
* test go get & convert to github import paths
* experiment with cross-compiling windows/linux
* Setup build system
Expand All @@ -48,14 +49,12 @@ Possible
* summary --> versions/&with?parameters

* add overview API
* add ``count`` field to host summary results?
* add ``app`` and ``host`` version summaries with counts of each version
* gzip responses when possible
* Add paging to REST results
* add ``since`` query parameter, which only returns newer ``version`` entries
* store and return app_data with each Version, allowing custom data
* store and return app_data with each Version, allowing custom application data
* Store more historical data from updates.

* Last update time for each app/version/machine. This would give a full version history for each machine.

* Store application specific state information.
12 changes: 10 additions & 2 deletions memstore/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,24 @@ func init() {
s = memstore.NewMemoryStore()
}

func ExampleMemoryStore_Versions() {
func ExampleMemoryStore_Versions_all() {
// returns all known Version structs
vers := s.Versions("", "", "")
for v := range vers {
fmt.Println(v)
}
}

func ExampleMemoryStore_Versions_appId() {
// returns all known Version structs for a specific AppId
vers := s.Versions("app1", "", "")
for v := range vers {
fmt.Println(v)
}
}

func ExampleMemoryStore_Update() {
v := version.Version{App: "app", Ver: "1.2.3", Host: "example.com"}
v := version.Version{App: "app1", Ver: "1.2.3", Host: "host1.example.com"}
err := s.Update(v)
if err != nil {
// handle error
Expand Down
4 changes: 4 additions & 0 deletions memstore/memstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ func NewMemoryStore() (m *MemoryStore) {
}

// App returns an AppSummary for the given AppId.
// The value of ok follows map indexing conventions: true if AppId is present,
// false otherwise.
func (s *MemoryStore) App(AppId string) (as version.AppSummary, ok bool) {
as, ok = s.app[AppId]
return
Expand All @@ -44,6 +46,8 @@ func (s *MemoryStore) Apps() []version.AppSummary {
}

// Host returns a HostSummary for the given Host.
// The value of ok follows map indexing conventions: true if Host is present,
// false otherwise.
func (s *MemoryStore) Host(Host string) (hs version.HostSummary, ok bool) {
hs, ok = s.host[Host]
return
Expand Down

0 comments on commit 2669aa0

Please sign in to comment.