github.com/nektos/act@v0.2.63/pkg/artifactcache/model.go (about)

     1  package artifactcache
     2  
     3  type Request struct {
     4  	Key     string `json:"key" `
     5  	Version string `json:"version"`
     6  	Size    int64  `json:"cacheSize"`
     7  }
     8  
     9  func (c *Request) ToCache() *Cache {
    10  	if c == nil {
    11  		return nil
    12  	}
    13  	ret := &Cache{
    14  		Key:     c.Key,
    15  		Version: c.Version,
    16  		Size:    c.Size,
    17  	}
    18  	if c.Size == 0 {
    19  		// So the request comes from old versions of actions, like `actions/cache@v2`.
    20  		// It doesn't send cache size. Set it to -1 to indicate that.
    21  		ret.Size = -1
    22  	}
    23  	return ret
    24  }
    25  
    26  type Cache struct {
    27  	ID        uint64 `json:"id" boltholdKey:"ID"`
    28  	Key       string `json:"key" boltholdIndex:"Key"`
    29  	Version   string `json:"version" boltholdIndex:"Version"`
    30  	Size      int64  `json:"cacheSize"`
    31  	Complete  bool   `json:"complete" boltholdIndex:"Complete"`
    32  	UsedAt    int64  `json:"usedAt" boltholdIndex:"UsedAt"`
    33  	CreatedAt int64  `json:"createdAt" boltholdIndex:"CreatedAt"`
    34  }