Esempio n. 1
0
// AddFenceExpiredActivity adds the activity to the stream of the owner.
func AddFenceExpiredActivity(ownerID int, fenceID int, fenceName string) error {
	now := int32(time.Now().Unix())

	bytes, err := json.Marshal(fenceExpiredActivity{Verb: "fenceExpired",
		FenceID:   fenceID,
		FenceName: fenceName,
		Time:      now})

	if err != nil {
		return err
	}

	return redis.AddActivity(ownerID, float64(now), string(bytes[:]))
}
Esempio n. 2
0
// AddForeignVisitedActivity adds the activity to the stream of the owner.
func AddForeignVisitedActivity(visitorID int, ownerName string, ownerID int, fenceName string, fenceID int, rent float64) error {
	now := int32(time.Now().Unix())

	bytes, err := json.Marshal(foreignFenceVisitedActivity{Verb: "foreignFenceVisited",
		OwnerName: ownerName,
		OwnerID:   ownerID,
		FenceName: fenceName,
		FenceID:   fenceID,
		Rent:      rent,
		Time:      now})

	if err != nil {
		return err
	}

	return redis.AddActivity(visitorID, float64(now), string(bytes[:]))
}