github.com/gramework/gramework@v1.8.1-0.20231027140105-82555c9057f5/infrastructure/types.go (about)

     1  // Deprecated: will be moved into another package.
     2  package infrastructure
     3  
     4  import (
     5  	"sync"
     6  )
     7  
     8  type (
     9  	// Infrastructure handles lists of services and current timestamp
    10  	Infrastructure struct {
    11  		Services         map[string]*Service `json:"services"`
    12  		UpdateTimestamp  int64               `json:"update_timestamp"`
    13  		CurrentTimestamp int64               `json:"current_timestamp"`
    14  		Lock             *sync.RWMutex       `json:"-"`
    15  	}
    16  
    17  	// Service defines an abstract service in infrastructure
    18  	Service struct {
    19  		Name      string      `json:"name"`
    20  		Addresses []Address   `json:"addresses"`
    21  		Type      ServiceType `json:"type"`
    22  	}
    23  
    24  	// Address defines service addr
    25  	Address struct {
    26  		Host string `json:"host"`
    27  		Port int    `json:"port"`
    28  		URL  string `json:"url"`
    29  	}
    30  
    31  	// ServiceType defines a type of protocol that
    32  	// service using
    33  	ServiceType string
    34  )